[Initng-svn] r3695 - in initng/trunk: devtool plugins/also plugins/bash_launcher plugins/chdir plugins/chroot plugins/conflict plugins/cpout plugins/critical plugins/ctrlaltdel plugins/daemon plugins/daemon/test plugins/daemon_clean plugins/dbus_event plugins/debug_commands plugins/envparser plugins/find plugins/fstat plugins/history plugins/idleprobe plugins/initctl plugins/interactive plugins/iparser plugins/last plugins/limit plugins/lockfile plugins/logfile plugins/netprobe plugins/ngc4 plugins/ngcs plugins/nge plugins/pause plugins/reload plugins/renice plugins/rlparser plugins/runlevel plugins/service plugins/simple_launcher plugins/stcmd plugins/stdout plugins/suid plugins/syncron plugins/syslog plugins/unneeded plugins/usplash src tools

svn at initng.thinktux.net svn at initng.thinktux.net
Wed Apr 5 23:11:26 CEST 2006


Author: jimmy
Date: Wed Apr  5 23:11:19 2006
New Revision: 3695

Modified:
   initng/trunk/devtool/indent.sh
   initng/trunk/devtool/indent_all.sh
   initng/trunk/devtool/test_parser.c
   initng/trunk/plugins/also/initng_also.c
   initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
   initng/trunk/plugins/chdir/initng_chdir.c
   initng/trunk/plugins/chroot/initng_chroot.c
   initng/trunk/plugins/conflict/initng_conflict.c
   initng/trunk/plugins/cpout/initng_colorprint_out.c
   initng/trunk/plugins/critical/initng_critical.c
   initng/trunk/plugins/ctrlaltdel/initng_ctrlaltdel.c
   initng/trunk/plugins/daemon/initng_daemon.c
   initng/trunk/plugins/daemon/test/test_pidfile.c
   initng/trunk/plugins/daemon_clean/initng_daemon_clean.c
   initng/trunk/plugins/dbus_event/dbus_nge.c
   initng/trunk/plugins/dbus_event/initng_dbusevent.c
   initng/trunk/plugins/debug_commands/initng_debug_commands.c
   initng/trunk/plugins/debug_commands/print_service.c
   initng/trunk/plugins/envparser/initng_envparser.c
   initng/trunk/plugins/find/initng_find.c
   initng/trunk/plugins/fstat/initng_fstat.c
   initng/trunk/plugins/history/initng_history.c
   initng/trunk/plugins/history/initng_history.h
   initng/trunk/plugins/idleprobe/initng_idleprobe.c
   initng/trunk/plugins/initctl/initng_initctl.c
   initng/trunk/plugins/initctl/initreq.h
   initng/trunk/plugins/interactive/initng_interactive.c
   initng/trunk/plugins/iparser/initng_i_parser.c
   initng/trunk/plugins/last/initng_last.c
   initng/trunk/plugins/limit/initng_limit.c
   initng/trunk/plugins/lockfile/initng_lockfile.c
   initng/trunk/plugins/logfile/initng_logfile.c
   initng/trunk/plugins/netprobe/initng_netprobe.c
   initng/trunk/plugins/ngc4/initng_ngc4.c
   initng/trunk/plugins/ngc4/initng_ngc4.h
   initng/trunk/plugins/ngc4/libngcclient.c
   initng/trunk/plugins/ngc4/libngcclient.h
   initng/trunk/plugins/ngc4/ngc4.c
   initng/trunk/plugins/ngcs/initng_ngcs.c
   initng/trunk/plugins/ngcs/initng_ngcs.h
   initng/trunk/plugins/ngcs/initng_ngcs_cmds.c
   initng/trunk/plugins/ngcs/ngcs_common.c
   initng/trunk/plugins/ngcs/ngcs_common.h
   initng/trunk/plugins/nge/initng_nge.c
   initng/trunk/plugins/nge/libngeclient.c
   initng/trunk/plugins/nge/libngeclient.h
   initng/trunk/plugins/nge/nge.c
   initng/trunk/plugins/nge/nge_raw.c
   initng/trunk/plugins/pause/initng_pause.c
   initng/trunk/plugins/reload/initng_reload.c
   initng/trunk/plugins/reload/initng_reload.h
   initng/trunk/plugins/renice/initng_renice.c
   initng/trunk/plugins/rlparser/initng_rl_parser.c
   initng/trunk/plugins/runlevel/initng_runlevel.c
   initng/trunk/plugins/service/initng_service.c
   initng/trunk/plugins/simple_launcher/initng_simple_launcher.c
   initng/trunk/plugins/stcmd/initng_stcmd.c
   initng/trunk/plugins/stdout/initng_stdout.c
   initng/trunk/plugins/suid/initng_suid.c
   initng/trunk/plugins/syncron/initng_syncron.c
   initng/trunk/plugins/syslog/initng_syslog.c
   initng/trunk/plugins/syslog/initng_syslog.h
   initng/trunk/plugins/unneeded/initng_unneeded.c
   initng/trunk/plugins/usplash/initng_usplash.c
   initng/trunk/src/initng.h
   initng/trunk/src/initng_active_db.c
   initng/trunk/src/initng_active_db.h
   initng/trunk/src/initng_active_state.c
   initng/trunk/src/initng_active_state.h
   initng/trunk/src/initng_common.c
   initng/trunk/src/initng_control_command.c
   initng/trunk/src/initng_control_command.h
   initng/trunk/src/initng_depend.c
   initng/trunk/src/initng_env_variable.c
   initng/trunk/src/initng_env_variable.h
   initng/trunk/src/initng_error.c
   initng/trunk/src/initng_error.h
   initng/trunk/src/initng_execute.c
   initng/trunk/src/initng_fd.c
   initng/trunk/src/initng_fork.c
   initng/trunk/src/initng_fork.h
   initng/trunk/src/initng_global.c
   initng/trunk/src/initng_global.h
   initng/trunk/src/initng_handler.c
   initng/trunk/src/initng_is.h
   initng/trunk/src/initng_kill_handler.c
   initng/trunk/src/initng_list.h
   initng/trunk/src/initng_load_module.c
   initng/trunk/src/initng_load_module.h
   initng/trunk/src/initng_main.c
   initng/trunk/src/initng_module.h
   initng/trunk/src/initng_msg.h
   initng/trunk/src/initng_open_read_close.c
   initng/trunk/src/initng_plugin.h
   initng/trunk/src/initng_plugin_callers.c
   initng/trunk/src/initng_plugin_hook.c
   initng/trunk/src/initng_plugin_hook.h
   initng/trunk/src/initng_process_db.c
   initng/trunk/src/initng_process_db.h
   initng/trunk/src/initng_service_cache.c
   initng/trunk/src/initng_service_cache.h
   initng/trunk/src/initng_service_data_types.c
   initng/trunk/src/initng_service_data_types.h
   initng/trunk/src/initng_service_types.c
   initng/trunk/src/initng_service_types.h
   initng/trunk/src/initng_signal.c
   initng/trunk/src/initng_signal.h
   initng/trunk/src/initng_static_data_id.c
   initng/trunk/src/initng_static_service_types.c
   initng/trunk/src/initng_static_states.c
   initng/trunk/src/initng_string_tools.c
   initng/trunk/src/initng_struct_data.c
   initng/trunk/src/initng_struct_data.h
   initng/trunk/src/initng_system_states.h
   initng/trunk/src/initng_toolbox.c
   initng/trunk/src/main.c
   initng/trunk/tools/killall5.c
   initng/trunk/tools/mountpoint.c
   initng/trunk/tools/sulogin.c
Log:
This looks better.


Modified: initng/trunk/devtool/indent.sh
==============================================================================
--- initng/trunk/devtool/indent.sh	(original)
+++ initng/trunk/devtool/indent.sh	Wed Apr  5 23:11:19 2006
@@ -1,2 +1,2 @@
 #/bin/bash
-exec indent -ut -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -fc1 -c45 -nsob $*
+exec indent -ut -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -ts4 -lp -fc1 -c45 -nsob $*

Modified: initng/trunk/devtool/indent_all.sh
==============================================================================
--- initng/trunk/devtool/indent_all.sh	(original)
+++ initng/trunk/devtool/indent_all.sh	Wed Apr  5 23:11:19 2006
@@ -8,14 +8,14 @@
 for file in `find . -name "*.c" -printf "%h/%f "`
 do
     echo "Indenting file: $file"
-    indent -ut -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -fc1 -c45 -nsob $file
+    indent -ut -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -ts4 -lp -fc1 -c45 -nsob $file
 done
 
 echo "scan for headers to indent."
 for file in `find . -name "*.h" -printf "%h/%f "`
 do
     echo "Indenting file: $file"
-    indent -ut -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -fc1 -c45 -nsob $file
+    indent -ut -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -ts4 -lp -fc1 -c45 -nsob $file
 done
 
 echo "Clean up."

Modified: initng/trunk/devtool/test_parser.c
==============================================================================
--- initng/trunk/devtool/test_parser.c	(original)
+++ initng/trunk/devtool/test_parser.c	Wed Apr  5 23:11:19 2006
@@ -20,14 +20,14 @@
 
 #include <initng.h>
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <termios.h>
 #include <stdio.h>
 #include <sys/klog.h>
@@ -41,7 +41,7 @@
 #include <main.h>
 #include <initng_signal.h>
 #include <initng_handler.h>
-#include <initng_execute.h>		    /* new_environ() */
+#include <initng_execute.h>					/* new_environ() */
 #include <initng_active_db.h>
 #include <initng_load_module.h>
 #include <initng_plugin_callers.h>
@@ -83,354 +83,354 @@
 int main(int argc, char *argv[], char *env[])
 {
 
-    int parse_all_files = 0;
-    int summary = 1;
-    int print_dep_err = 0;
-    int result = NOT_OK;
-
-    service_cache_h *current = NULL;
-
-    /* initialise global variables */
-    initng_global_new(argc, argv, env);
-
-    if (!initng_load_module_load_all())
-    {
-	printf("could not load all modules\n");
-	goto exit;
-    }
+	int parse_all_files = 0;
+	int summary = 1;
+	int print_dep_err = 0;
+	int result = NOT_OK;
 
-    /* enable verbose mode */
+	service_cache_h *current = NULL;
+
+	/* initialise global variables */
+	initng_global_new(argc, argv, env);
+
+	if (!initng_load_module_load_all())
+	{
+		printf("could not load all modules\n");
+		goto exit;
+	}
+
+	/* enable verbose mode */
 #ifdef DEBUG
-    g.verbose = 0;
+	g.verbose = 0;
 #endif
 
-    int i;
-    char *srv_name = i_strdup("default");
+	int i;
+	char *srv_name = i_strdup("default");
 
-    for (i = 1; i < argc; i++)
-    {
-	int opt_type = 0;
-	char *opt = argv[i];
+	for (i = 1; i < argc; i++)
+	{
+		int opt_type = 0;
+		char *opt = argv[i];
 
-	if (strlen(opt) <= 1)
-	    continue;
+		if (strlen(opt) <= 1)
+			continue;
 
-	if (opt[0] == '-' && opt[1] == '-')
-	{
-	    if (strlen(opt) == 2)
-		continue;
+		if (opt[0] == '-' && opt[1] == '-')
+		{
+			if (strlen(opt) == 2)
+				continue;
 
-	    opt_type = 1;
-	    opt += 2;
-	}
-	else if (opt[0] == '-')
-	{
-	    opt_type = 2;
-	    opt++;
-	}
+			opt_type = 1;
+			opt += 2;
+		}
+		else if (opt[0] == '-')
+		{
+			opt_type = 2;
+			opt++;
+		}
 
-	if (opt_type == 1)
-	{
-	    if (strcmp(opt, "verbose") == 0)
-		verbose = 1;
+		if (opt_type == 1)
+		{
+			if (strcmp(opt, "verbose") == 0)
+				verbose = 1;
 
-	    if (strcmp(opt, "all") == 0)
-		parse_all_files = 1;
+			if (strcmp(opt, "all") == 0)
+				parse_all_files = 1;
 
-	    if (strcmp(opt, "no_summary") == 0)
-		summary = 0;
+			if (strcmp(opt, "no_summary") == 0)
+				summary = 0;
 
-	    if (strcmp(opt, "check_circular") == 0)
-		check_circular = 1;
+			if (strcmp(opt, "check_circular") == 0)
+				check_circular = 1;
 
-	    if (strcmp(opt, "print_each") == 0)
-		print_each = 1;
+			if (strcmp(opt, "print_each") == 0)
+				print_each = 1;
 
-	    if (strcmp(opt, "print_dep_err") == 0)
-		print_dep_err = 1;
-	}
-	else if (opt_type == 2)
-	{
-	    if (strcmp(opt, "v") == 0)
-		verbose = 1;
+			if (strcmp(opt, "print_dep_err") == 0)
+				print_dep_err = 1;
+		}
+		else if (opt_type == 2)
+		{
+			if (strcmp(opt, "v") == 0)
+				verbose = 1;
 
-	    if (strcmp(opt, "a") == 0)
-		parse_all_files = 1;
+			if (strcmp(opt, "a") == 0)
+				parse_all_files = 1;
 
-	    if (strcmp(opt, "s") == 0)
-		summary = 0;
+			if (strcmp(opt, "s") == 0)
+				summary = 0;
 
-	    if (strcmp(opt, "c") == 0)
-		check_circular = 1;
+			if (strcmp(opt, "c") == 0)
+				check_circular = 1;
 
-	    if (strcmp(opt, "p") == 0)
-		print_each = 1;
+			if (strcmp(opt, "p") == 0)
+				print_each = 1;
 
-	    if (strcmp(opt, "d") == 0)
-		print_dep_err = 1;
+			if (strcmp(opt, "d") == 0)
+				print_dep_err = 1;
 
+		}
+		else
+		{
+			free(srv_name);
+			srv_name = opt;
+		}
 	}
-	else
+
+	if (parse_all_files == 1)
 	{
-	    free(srv_name);
-	    srv_name = opt;
+		result = parse_all("system");
+		result &= parse_all("daemon");
+		result &= parse_all("net");
+		//parse_all("debug");
+		result &= parse_all("daemon/bluetooth");
 	}
-    }
+	else
+	{
+		result = load_service(srv_name, 0);
+		if (check_circular == 1)
+			result &= check_deps(NULL, srv_name, 0);
 
-    if (parse_all_files == 1)
-    {
-	result = parse_all("system");
-	result &= parse_all("daemon");
-	result &= parse_all("net");
-	//parse_all("debug");
-	result &= parse_all("daemon/bluetooth");
-    }
-    else
-    {
-	result = load_service(srv_name, 0);
-	if (check_circular == 1)
-	    result &= check_deps(NULL, srv_name, 0);
-
-	if (summary == 1)
-	{
-	    if (result == NOT_OK)
-	    {
-		printf("Service %s is failed because:\n", srv_name);
-		while_service_cache(current)
+		if (summary == 1)
 		{
-		    switch (get_int(&STATUS, current))
-		    {
-			case PARSE_ERR:
-			    printf("%s has parsing errors or service file was not found\n", current->name);
-			    break;
-			case CIRCULAR_ERR:
-			    printf("%s has circular dependency with %s\n",
-				   current->name,
-				   get_string(&CIRCULAR, current));
-			    break;
-			case DEPEND_ERR:
-			    if (print_dep_err == 1)
-				printf("%s has one of its depends failed\n",
-				       current->name);
-			    break;
-			default:
-			    break;
-		    };
+			if (result == NOT_OK)
+			{
+				printf("Service %s is failed because:\n", srv_name);
+				while_service_cache(current)
+				{
+					switch (get_int(&STATUS, current))
+					{
+						case PARSE_ERR:
+							printf("%s has parsing errors or service file was not found\n", current->name);
+							break;
+						case CIRCULAR_ERR:
+							printf("%s has circular dependency with %s\n",
+								   current->name,
+								   get_string(&CIRCULAR, current));
+							break;
+						case DEPEND_ERR:
+							if (print_dep_err == 1)
+								printf("%s has one of its depends failed\n",
+									   current->name);
+							break;
+						default:
+							break;
+					};
+				}
+			}
+			else
+				printf("Service %s is ok.\n", srv_name);
 		}
-	    }
-	    else
-		printf("Service %s is ok.\n", srv_name);
-	}
 
-    }
+	}
 
   exit:
-    /* unload all modules */
-    initng_unload_module_unload_all();
-    initng_service_cache_free_all();
-    initng_global_free();
-    return (result == NOT_OK) ? OK : NOT_OK;
+	/* unload all modules */
+	initng_unload_module_unload_all();
+	initng_service_cache_free_all();
+	initng_global_free();
+	return (result == NOT_OK) ? OK : NOT_OK;
 }
 
 static int parse_all(const char *dirname)
 {
-    struct dirent *e;
-    char tmp[200];
-    char tmp2[200];
-    DIR *d;
-    int i;
-    int result = NOT_OK;
+	struct dirent *e;
+	char tmp[200];
+	char tmp2[200];
+	DIR *d;
+	int i;
+	int result = NOT_OK;
+
+	sprintf(tmp, INITNG_ROOT "/%s", dirname);
+
+	d = opendir(tmp);
+	if (!d)
+		return result;
 
-    sprintf(tmp, INITNG_ROOT "/%s", dirname);
+	result = OK;
 
-    d = opendir(tmp);
-    if (!d)
-	return result;
+	while ((e = readdir(d)))
+	{
+		if (e->d_name[0] == '.')
+			continue;
 
-    result = OK;
+		/* get string length */
+		i = strlen(e->d_name);
 
-    while ((e = readdir(d)))
-    {
-	if (e->d_name[0] == '.')
-	    continue;
-
-	/* get string length */
-	i = strlen(e->d_name);
-
-	/* Check that is it a .i file */
-	if (e->d_name[i - 1] != 'i' && e->d_name[i - 2] != '.')
-	    continue;
-
-	strncpy(tmp, e->d_name, i - 2);
-	tmp[i - 2] = '\0';
-	sprintf(tmp2, "%s/%s", dirname, tmp);
-	result &= load_service(tmp2, 0);
-	if (check_circular == 1)
-	    result &= check_deps(NULL, tmp2, 0);
-    }
+		/* Check that is it a .i file */
+		if (e->d_name[i - 1] != 'i' && e->d_name[i - 2] != '.')
+			continue;
+
+		strncpy(tmp, e->d_name, i - 2);
+		tmp[i - 2] = '\0';
+		sprintf(tmp2, "%s/%s", dirname, tmp);
+		result &= load_service(tmp2, 0);
+		if (check_circular == 1)
+			result &= check_deps(NULL, tmp2, 0);
+	}
 
-    closedir(d);
-    return result;
+	closedir(d);
+	return result;
 }
 
 static int load_service(const char *name, int level)
 {
-    service_cache_h *service = NULL;
-    service_cache_h *tmp_service = NULL;
-    const char *string = NULL;
-    int result = NOT_OK;
-    int srv_status;
-    int i;
-
-    if (verbose == 1)
-    {
-	SPACE;
-	printf("Probeparsing: %s\n", name);
-    }
-
-    service = initng_common_parse_service(name);
-    if (!service)
-    {
-	/* unload all modules 
-	   initng_unload_all_modules();
-	   initng_free();
-	   exit(2);
-	 */
+	service_cache_h *service = NULL;
+	service_cache_h *tmp_service = NULL;
+	const char *string = NULL;
+	int result = NOT_OK;
+	int srv_status;
+	int i;
+
 	if (verbose == 1)
 	{
-	    SPACE;
-	    printf("%s - failed\n", name);
+		SPACE;
+		printf("Probeparsing: %s\n", name);
 	}
-	service = initng_service_cache_new(name,
-					   initng_service_types_get
-					   ("service"));
-	if (service)
+
+	service = initng_common_parse_service(name);
+	if (!service)
 	{
-	    initng_service_cache_add(service);
-	    set_int(&STATUS, service, PARSE_ERR);
+		/* unload all modules 
+		   initng_unload_all_modules();
+		   initng_free();
+		   exit(2);
+		 */
+		if (verbose == 1)
+		{
+			SPACE;
+			printf("%s - failed\n", name);
+		}
+		service = initng_service_cache_new(name,
+										   initng_service_types_get
+										   ("service"));
+		if (service)
+		{
+			initng_service_cache_add(service);
+			set_int(&STATUS, service, PARSE_ERR);
+		}
+		return result;
 	}
-	return result;
-    }
 
-    if (print_each == 1)
-    {
-	char *string = service_db_print(service);
-
-	printf("%s\n", string);
-	free(string);
-    }
-
-    result = OK;
-
-    set_int(&STATUS, service, OK);
-    s_data *itt = NULL;
-
-    while ((string = get_next_string(&NEED, service, &itt)))
-    {
-	tmp_service = initng_service_cache_find_by_name(string);
-	if (!tmp_service || (srv_status = get_int(&STATUS, tmp_service)) == 0)
-	    result &= load_service(string, level + 1);
-	else
-	    result &= (srv_status > NOT_OK) ? OK : NOT_OK;
-    }
+	if (print_each == 1)
+	{
+		char *string = service_db_print(service);
+
+		printf("%s\n", string);
+		free(string);
+	}
 
+	result = OK;
 
-    if (verbose == 1)
-    {
-	SPACE;
-	if (result == NOT_OK)
-	    printf("%s - failed\n", name);
-	else
-	    printf("%s - ok\n", name);
-    }
+	set_int(&STATUS, service, OK);
+	s_data *itt = NULL;
+
+	while ((string = get_next_string(&NEED, service, &itt)))
+	{
+		tmp_service = initng_service_cache_find_by_name(string);
+		if (!tmp_service || (srv_status = get_int(&STATUS, tmp_service)) == 0)
+			result &= load_service(string, level + 1);
+		else
+			result &= (srv_status > NOT_OK) ? OK : NOT_OK;
+	}
+
+
+	if (verbose == 1)
+	{
+		SPACE;
+		if (result == NOT_OK)
+			printf("%s - failed\n", name);
+		else
+			printf("%s - ok\n", name);
+	}
 
-    set_int(&STATUS, service, (result == NOT_OK) ? DEPEND_ERR : OK);
+	set_int(&STATUS, service, (result == NOT_OK) ? DEPEND_ERR : OK);
 
-    return result;
+	return result;
 }
 
 static int check_deps(const char **dep_list, const char *dep, int level)
 {
-    int result = NOT_OK;
-    int tmp_result;
-    int status;
-    const char **my_list;
-    const char *string = NULL;
-    int i, j;
-    service_cache_h *service = initng_service_cache_find_by_name(dep);
-
-    if (verbose == 1)
-    {
-	SPACE;
-	printf("Checking: %s\n", dep);
-    }
-
-    if (!service)
-	status = NOT_OK;
-    else
-	status = get_int(&STATUS, service);
-
-    if (status == CHECKED)
-	result = OK;
+	int result = NOT_OK;
+	int tmp_result;
+	int status;
+	const char **my_list;
+	const char *string = NULL;
+	int i, j;
+	service_cache_h *service = initng_service_cache_find_by_name(dep);
 
-    if (status == OK)
-    {
-	s_data *itt = NULL;
+	if (verbose == 1)
+	{
+		SPACE;
+		printf("Checking: %s\n", dep);
+	}
 
-	result = OK;
+	if (!service)
+		status = NOT_OK;
+	else
+		status = get_int(&STATUS, service);
 
-	my_list = (const char **) i_calloc(level + 2, sizeof(char *));
-	my_list[level + 1] = NULL;
+	if (status == CHECKED)
+		result = OK;
 
-	while ((string = get_next_string(&NEED, service, &itt)))
+	if (status == OK)
 	{
-	    tmp_result = OK;
+		s_data *itt = NULL;
+
+		result = OK;
+
+		my_list = (const char **) i_calloc(level + 2, sizeof(char *));
+		my_list[level + 1] = NULL;
 
-	    for (j = 0; dep_list && dep_list[j]; j++)
-	    {
-		if (strcmp(string, dep_list[j]) == 0)
+		while ((string = get_next_string(&NEED, service, &itt)))
 		{
-		    status = CIRCULAR_ERR;
-		    set_int(&STATUS, service, status);
-		    set_string(&CIRCULAR, service, i_strdup(string));
-		    if (verbose == 1)
-		    {
-			SPACE;
-			printf("Service %s has circular dependency with %s\n",
-			       dep, string);
-		    }
-		    tmp_result = NOT_OK;
-		    break;
+			tmp_result = OK;
+
+			for (j = 0; dep_list && dep_list[j]; j++)
+			{
+				if (strcmp(string, dep_list[j]) == 0)
+				{
+					status = CIRCULAR_ERR;
+					set_int(&STATUS, service, status);
+					set_string(&CIRCULAR, service, i_strdup(string));
+					if (verbose == 1)
+					{
+						SPACE;
+						printf("Service %s has circular dependency with %s\n",
+							   dep, string);
+					}
+					tmp_result = NOT_OK;
+					break;
+				}
+				my_list[j] = dep_list[j];
+			}
+
+			if (tmp_result == OK)
+			{
+				my_list[j] = dep;
+				tmp_result = check_deps(my_list, string, level + 1);
+			}
+
+			result &= tmp_result;
 		}
-		my_list[j] = dep_list[j];
-	    }
+		free(my_list);
+	}
 
-	    if (tmp_result == OK)
-	    {
-		my_list[j] = dep;
-		tmp_result = check_deps(my_list, string, level + 1);
-	    }
-
-	    result &= tmp_result;
-	}
-	free(my_list);
-    }
-
-    if (verbose == 1)
-    {
-	SPACE;
-	if (result == NOT_OK)
-	    printf("%s - failed\n", dep);
-	else
-	    printf("%s - ok\n", dep);
-    }
+	if (verbose == 1)
+	{
+		SPACE;
+		if (result == NOT_OK)
+			printf("%s - failed\n", dep);
+		else
+			printf("%s - ok\n", dep);
+	}
 
-    status = (result ==
-	      OK) ? CHECKED : ((status !=
-				CIRCULAR_ERR) ? DEPEND_ERR : CIRCULAR_ERR);
+	status = (result ==
+			  OK) ? CHECKED : ((status !=
+								CIRCULAR_ERR) ? DEPEND_ERR : CIRCULAR_ERR);
 
-    if (service)
-	set_int(&STATUS, service, status);
+	if (service)
+		set_int(&STATUS, service, status);
 
-    return result;
+	return result;
 }

Modified: initng/trunk/plugins/also/initng_also.c
==============================================================================
--- initng/trunk/plugins/also/initng_also.c	(original)
+++ initng/trunk/plugins/also/initng_also.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 
@@ -35,107 +35,107 @@
 #include <initng_env_variable.h>
 
 s_entry ALSO_START = { "also_start", STRINGS, NULL,
-    "When this service is starting, also start this."
+	"When this service is starting, also start this."
 };
 s_entry ALSO_STOP = { "also_stop", STRINGS, NULL,
-    "When this service is stopping, also stop this."
+	"When this service is stopping, also stop this."
 };
 
 static int service_state(active_db_h * service)
 {
-    const char *tmp = NULL;
-    active_db_h *current = NULL;
+	const char *tmp = NULL;
+	active_db_h *current = NULL;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* if service is loading, start all in ALSO_START */
-    if (IS_STARTING(service))
-    {
-	tmp = NULL;
-	s_data *itt = NULL;
-
-	while ((tmp = get_next_string(&ALSO_START, service, &itt)))
+	/* if service is loading, start all in ALSO_START */
+	if (IS_STARTING(service))
 	{
-	    char *fixed = NULL;
+		tmp = NULL;
+		s_data *itt = NULL;
 
-	    fixed = fix_variables(tmp, service);
-	    if ((current = initng_active_db_find_by_name(fixed)))
-	    {
-		if (!initng_handler_start_service(current))
+		while ((tmp = get_next_string(&ALSO_START, service, &itt)))
 		{
-		    F_("Failed to also_start %s.\n", fixed);
-		    free(fixed);
-		    continue;
+			char *fixed = NULL;
+
+			fixed = fix_variables(tmp, service);
+			if ((current = initng_active_db_find_by_name(fixed)))
+			{
+				if (!initng_handler_start_service(current))
+				{
+					F_("Failed to also_start %s.\n", fixed);
+					free(fixed);
+					continue;
+				}
+				D_("Service also_start %s already running.\n", fixed);
+				free(fixed);
+				continue;
+			}
+
+			if (!initng_handler_start_new_service_named(fixed))
+			{
+				F_("%s also_start %s could not start!\n", service->name,
+				   fixed);
+				initng_handler_stop_service(service);
+				free(fixed);
+				return (FALSE);
+			}
 		}
-		D_("Service also_start %s already running.\n", fixed);
-		free(fixed);
-		continue;
-	    }
-
-	    if (!initng_handler_start_new_service_named(fixed))
-	    {
-		F_("%s also_start %s could not start!\n", service->name,
-		   fixed);
-		initng_handler_stop_service(service);
-		free(fixed);
-		return (FALSE);
-	    }
+		return (TRUE);
 	}
-	return (TRUE);
-    }
 
-    /* if this service is stopping, stop all in ALSO_STOP */
-    if (IS_STOPPING(service))
-    {
-	/* Handle ALSO_STOP */
-	tmp = NULL;
-	s_data *itt = NULL;
-
-	while ((tmp = get_next_string(&ALSO_STOP, service, &itt)))
+	/* if this service is stopping, stop all in ALSO_STOP */
+	if (IS_STOPPING(service))
 	{
-	    char *fixed = NULL;
-
-	    fixed = fix_variables(tmp, service);
-	    if ((current = initng_active_db_find_by_name(fixed)))
-	    {
-		/* Tell this verbose */
-		D_("service %s also stops %s\n", service->name, fixed);
+		/* Handle ALSO_STOP */
+		tmp = NULL;
+		s_data *itt = NULL;
 
-		if (!initng_handler_stop_service(current))
+		while ((tmp = get_next_string(&ALSO_STOP, service, &itt)))
 		{
-		    F_("Could not stop also_stop service %s\n",
-		       current->name);
+			char *fixed = NULL;
+
+			fixed = fix_variables(tmp, service);
+			if ((current = initng_active_db_find_by_name(fixed)))
+			{
+				/* Tell this verbose */
+				D_("service %s also stops %s\n", service->name, fixed);
+
+				if (!initng_handler_stop_service(current))
+				{
+					F_("Could not stop also_stop service %s\n",
+					   current->name);
+				}
+			}
+			free(fixed);
 		}
-	    }
-	    free(fixed);
+		return (TRUE);
 	}
-	return (TRUE);
-    }
 
-    return (TRUE);
+	return (TRUE);
 }
 
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&ALSO_START);
-    initng_service_data_types_add(&ALSO_STOP);
-    initng_plugin_hook_add(&g.IS_CHANGE, 50, &service_state);
-    return (TRUE);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&ALSO_START);
+	initng_service_data_types_add(&ALSO_STOP);
+	initng_plugin_hook_add(&g.IS_CHANGE, 50, &service_state);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&ALSO_START);
-    initng_service_data_types_del(&ALSO_STOP);
-    initng_plugin_hook_del(&g.IS_CHANGE, &service_state);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&ALSO_START);
+	initng_service_data_types_del(&ALSO_STOP);
+	initng_plugin_hook_del(&g.IS_CHANGE, &service_state);
 }

Modified: initng/trunk/plugins/bash_launcher/initng_bash_launcher.c
==============================================================================
--- initng/trunk/plugins/bash_launcher/initng_bash_launcher.c	(original)
+++ initng/trunk/plugins/bash_launcher/initng_bash_launcher.c	Wed Apr  5 23:11:19 2006
@@ -20,12 +20,12 @@
 
 #include <initng.h>
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <unistd.h>			    /* execv() pipe() usleep() pause() chown() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdlib.h>			    /* free() exit() */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <unistd.h>							/* execv() pipe() usleep() pause() chown() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdlib.h>							/* free() exit() */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
@@ -51,145 +51,145 @@
 #include <initng_env_variable.h>
 
 s_entry SCRIPT = { "script", VARIABLE_STRING, NULL,
-    "A shell script, inserted into a multiline variable."
+	"A shell script, inserted into a multiline variable."
 };
 s_entry SCRIPT_OPT = { "script_opt", VARIABLE_STRING, NULL,
-    "The options bash should get."
+	"The options bash should get."
 };
 
 static void bash_this(const char *bash_code, active_db_h * s,
-		      const char *args);
+					  const char *args);
 static int bash_exec(process_h * process_to_exec, active_db_h * s,
-		     const char *script, const char *args);
+					 const char *script, const char *args);
 
 
 static int initng_bash(active_db_h * service, process_h * process)
 {
-    const char *e = NULL;
-    const char *args = NULL;
+	const char *e = NULL;
+	const char *args = NULL;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* WE ARE EXECUTING A START MULTILINE_STRING */
-    if (!(e = get_string_var(&SCRIPT, process->pt->name, service)))
-	return (FALSE);
+	/* WE ARE EXECUTING A START MULTILINE_STRING */
+	if (!(e = get_string_var(&SCRIPT, process->pt->name, service)))
+		return (FALSE);
 
-    /* get the arguments if any */
-    args = get_string_var(&SCRIPT_OPT, process->pt->name, service);
+	/* get the arguments if any */
+	args = get_string_var(&SCRIPT_OPT, process->pt->name, service);
 
-    /*D_("initng_bash(%s, %s, %s);\n", service->name, e, args); */
-    return (bash_exec(process, service, e, args));
+	/*D_("initng_bash(%s, %s, %s);\n", service->name, e, args); */
+	return (bash_exec(process, service, e, args));
 }
 
 
 static void bash_this(const char *bash_code, active_db_h * s,
-		      const char *args)
+					  const char *args)
 {
-    /* temporary argv */
-    char **argtmp;
+	/* temporary argv */
+	char **argtmp;
+
+	D_("bash_this(%s);\n", s->name);
 
-    D_("bash_this(%s);\n", s->name);
+	/* Todo : move bash_this into initng_bash_launcher and parse args properly\n" */
 
-    /* Todo : move bash_this into initng_bash_launcher and parse args properly\n" */
+	/* allocate, and fill the temp argv */
+	argtmp = (char **) i_calloc(8, sizeof(char *));
+	argtmp[0] = (char *) i_calloc(1, sizeof(char) * (15 + strlen(s->name)));
+	strcpy(argtmp[0], "bash_helper[");
+	strcat(argtmp[0], s->name);
+	strcat(argtmp[0], "]");
+	argtmp[1] = i_strdup("-c");
+	argtmp[2] = i_strdup(bash_code);
+	/* Why do we add service name as argument to shell?!?
+	   argtmp[3] = i_strdup(s->name);
+	 */
+
+	if (args)
+		argtmp[3] = i_strdup(args);
+	argtmp[4] = NULL;
 
-    /* allocate, and fill the temp argv */
-    argtmp = (char **) i_calloc(8, sizeof(char *));
-    argtmp[0] = (char *) i_calloc(1, sizeof(char) * (15 + strlen(s->name)));
-    strcpy(argtmp[0], "bash_helper[");
-    strcat(argtmp[0], s->name);
-    strcat(argtmp[0], "]");
-    argtmp[1] = i_strdup("-c");
-    argtmp[2] = i_strdup(bash_code);
-    /* Why do we add service name as argument to shell?!?
-       argtmp[3] = i_strdup(s->name);
-     */
-
-    if (args)
-	argtmp[3] = i_strdup(args);
-    argtmp[4] = NULL;
-
-    /* execute */
-    execve("/bin/sh", argtmp, new_environ(s));
-
-    /* free them all */
-    {
-	int i = 0;
+	/* execute */
+	execve("/bin/sh", argtmp, new_environ(s));
 
-	while (argtmp[i])
+	/* free them all */
 	{
-	    free(argtmp[i]);
-	    argtmp[i] = NULL;
-	    i++;
+		int i = 0;
+
+		while (argtmp[i])
+		{
+			free(argtmp[i]);
+			argtmp[i] = NULL;
+			i++;
+		}
 	}
-    }
-    free(argtmp);
+	free(argtmp);
 
-    /* put an error message up */
-    F_("bash_this(): child died!\n ERROR!\n");
+	/* put an error message up */
+	F_("bash_this(): child died!\n ERROR!\n");
 
-    /* system free */
-    initng_global_free();
+	/* system free */
+	initng_global_free();
 
-    /* exit 1, to emit an false signal */
-    _exit(1);
-}					    /* end fork_and_exec() */
+	/* exit 1, to emit an false signal */
+	_exit(1);
+}											/* end fork_and_exec() */
 
 
 
 static int bash_exec(process_h * process_to_exec, active_db_h * s,
-		     const char *script, const char *args)
+					 const char *script, const char *args)
 {
 
-    /* called from inside the service directory, return the PID or 0 on error */
+	/* called from inside the service directory, return the PID or 0 on error */
 
-    /* This is the real service kicker */
-    pid_t pid_fork;		/* pid got from fork() */
+	/* This is the real service kicker */
+	pid_t pid_fork;				/* pid got from fork() */
 
-    assert(process_to_exec);
-    assert(script);
+	assert(process_to_exec);
+	assert(script);
 
-    if ((pid_fork = initng_fork(s, process_to_exec)) == 0)
-    {
-	/* execute code */
-	bash_this(script, s, args);
+	if ((pid_fork = initng_fork(s, process_to_exec)) == 0)
+	{
+		/* execute code */
+		bash_this(script, s, args);
 
-	/* Bash This should NOT return! */
-	_exit(33);
-    }
+		/* Bash This should NOT return! */
+		_exit(33);
+	}
 
-    /* save pid of fork */
-    D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
+	/* save pid of fork */
+	D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
 
-    if (pid_fork > 1)
-	return (TRUE);
+	if (pid_fork > 1)
+		return (TRUE);
 
-    F_("bash_exec, did not get a pid!\n");
-    process_to_exec->pid = 0;
-    return (FALSE);
+	F_("bash_exec, did not get a pid!\n");
+	process_to_exec->pid = 0;
+	return (FALSE);
 
 }
 int module_init(int api_version)
 {
-    D_("initng_simple_plugin: module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("initng_simple_plugin: module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&SCRIPT);
-    initng_service_data_types_add(&SCRIPT_OPT);
+	initng_service_data_types_add(&SCRIPT);
+	initng_service_data_types_add(&SCRIPT_OPT);
 
-    initng_plugin_hook_add(&g.LAUNCH, 51, &initng_bash);
-    return (TRUE);
+	initng_plugin_hook_add(&g.LAUNCH, 51, &initng_bash);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    initng_service_data_types_del(&SCRIPT);
-    initng_service_data_types_del(&SCRIPT_OPT);
+	initng_service_data_types_del(&SCRIPT);
+	initng_service_data_types_del(&SCRIPT_OPT);
 
-    D_("initng_simple_plugin: module_unload();\n");
-    initng_plugin_hook_del(&g.LAUNCH, &initng_bash);
+	D_("initng_simple_plugin: module_unload();\n");
+	initng_plugin_hook_del(&g.LAUNCH, &initng_bash);
 }

Modified: initng/trunk/plugins/chdir/initng_chdir.c
==============================================================================
--- initng/trunk/plugins/chdir/initng_chdir.c	(original)
+++ initng/trunk/plugins/chdir/initng_chdir.c	Wed Apr  5 23:11:19 2006
@@ -34,53 +34,53 @@
 #include <initng_env_variable.h>
 
 s_entry CHDIR = { "chdir", STRING, NULL,
-    "Change to this directory before launching."
+	"Change to this directory before launching."
 };
 
 static int do_chdir(active_db_h * s, process_h * p __attribute__ ((unused)))
 {
-    const char *tmp = NULL;
-    char *tmp_fixed = NULL;
+	const char *tmp = NULL;
+	char *tmp_fixed = NULL;
 
-    assert(s);
-    assert(s->name);
-    assert(p);
-
-    D_("do_chdir!\n");
-    if (!(tmp = get_string(&CHDIR, s)))
-    {
-	D_("CHDIR not set!\n");
-	return (TRUE);
-    }
-    tmp_fixed = fix_variables(tmp, s);
-    D_("CHDIR TO %s\n", tmp_fixed);
-    if (chdir(tmp_fixed) == -1)
-    {
-	F_("Chdir failed with %s\n", strerror(errno));
+	assert(s);
+	assert(s->name);
+	assert(p);
+
+	D_("do_chdir!\n");
+	if (!(tmp = get_string(&CHDIR, s)))
+	{
+		D_("CHDIR not set!\n");
+		return (TRUE);
+	}
+	tmp_fixed = fix_variables(tmp, s);
+	D_("CHDIR TO %s\n", tmp_fixed);
+	if (chdir(tmp_fixed) == -1)
+	{
+		F_("Chdir failed with %s\n", strerror(errno));
+		free(tmp_fixed);
+		return (FALSE);
+	}
 	free(tmp_fixed);
-	return (FALSE);
-    }
-    free(tmp_fixed);
-    return (TRUE);
+	return (TRUE);
 }
 
 
 int module_init(int api_version)
 {
-    D_("module_init(CHDIR);\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init(CHDIR);\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&CHDIR);
-    return (initng_plugin_hook_add(&g.A_FORK, 50, &do_chdir));
+	initng_service_data_types_add(&CHDIR);
+	return (initng_plugin_hook_add(&g.A_FORK, 50, &do_chdir));
 }
 
 void module_unload(void)
 {
-    D_("module_unload(CHDIR);\n");
-    initng_service_data_types_del(&CHDIR);
-    initng_plugin_hook_del(&g.A_FORK, &do_chdir);
+	D_("module_unload(CHDIR);\n");
+	initng_service_data_types_del(&CHDIR);
+	initng_plugin_hook_del(&g.A_FORK, &do_chdir);
 }

Modified: initng/trunk/plugins/chroot/initng_chroot.c
==============================================================================
--- initng/trunk/plugins/chroot/initng_chroot.c	(original)
+++ initng/trunk/plugins/chroot/initng_chroot.c	Wed Apr  5 23:11:19 2006
@@ -34,60 +34,60 @@
 #include <initng_env_variable.h>
 
 s_entry CHROOT = { "chroot", STRING, NULL,
-    "Chroot this path, before launching the service."
+	"Chroot this path, before launching the service."
 };
 
 static int do_chroot(active_db_h * s, process_h * p __attribute__ ((unused)))
 {
-    const char *tmp = NULL;
-    char *tmp_fixed = NULL;
+	const char *tmp = NULL;
+	char *tmp_fixed = NULL;
 
-    assert(s);
-    assert(s->name);
-    assert(p);
-
-    D_("do_suid!\n");
-    if (!(tmp = get_string(&CHROOT, s)))
-    {
-	D_("SUID not set!\n");
-	return (TRUE);
-    }
-
-    /* fix ev.${VARIABLES} */
-    tmp_fixed = fix_variables(tmp, s);
-
-    if (chdir(tmp_fixed) == -1)
-    {
-	F_("Chdir %s failed with %s\n", tmp_fixed, strerror(errno));
+	assert(s);
+	assert(s->name);
+	assert(p);
+
+	D_("do_suid!\n");
+	if (!(tmp = get_string(&CHROOT, s)))
+	{
+		D_("SUID not set!\n");
+		return (TRUE);
+	}
+
+	/* fix ev.${VARIABLES} */
+	tmp_fixed = fix_variables(tmp, s);
+
+	if (chdir(tmp_fixed) == -1)
+	{
+		F_("Chdir %s failed with %s\n", tmp_fixed, strerror(errno));
+		free(tmp_fixed);
+		return (FALSE);
+	}
+	if (chroot(tmp_fixed) == -1)
+	{
+		F_("Chroot %s failed with %s\n", tmp_fixed, strerror(errno));
+		free(tmp_fixed);
+		return (FALSE);
+	}
 	free(tmp_fixed);
-	return (FALSE);
-    }
-    if (chroot(tmp_fixed) == -1)
-    {
-	F_("Chroot %s failed with %s\n", tmp_fixed, strerror(errno));
-	free(tmp_fixed);
-	return (FALSE);
-    }
-    free(tmp_fixed);
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&CHROOT);
-    return (initng_plugin_hook_add(&g.A_FORK, 50, &do_chroot));
+	initng_service_data_types_add(&CHROOT);
+	return (initng_plugin_hook_add(&g.A_FORK, 50, &do_chroot));
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&CHROOT);
-    initng_plugin_hook_del(&g.A_FORK, &do_chroot);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&CHROOT);
+	initng_plugin_hook_del(&g.A_FORK, &do_chroot);
 }

Modified: initng/trunk/plugins/conflict/initng_conflict.c
==============================================================================
--- initng/trunk/plugins/conflict/initng_conflict.c	(original)
+++ initng/trunk/plugins/conflict/initng_conflict.c	Wed Apr  5 23:11:19 2006
@@ -21,8 +21,8 @@
 
 
 #include <stdio.h>
-#include <string.h>			    /* strstr() */
-#include <stdlib.h>			    /* free() exit() */
+#include <string.h>							/* strstr() */
+#include <stdlib.h>							/* free() exit() */
 #include <assert.h>
 
 #include <initng_handler.h>
@@ -34,72 +34,72 @@
 #include <initng_env_variable.h>
 
 s_entry CONFLICT = { "conflict", STRINGS, NULL,
-    "If service put here is starting or running, bail out."
+	"If service put here is starting or running, bail out."
 };
 
 a_state_h CONFLICTING = { "FAILED_BY_CONFLICT", IS_FAILED, NULL, NULL, NULL };
 
 static int check_conflict(active_db_h * service)
 {
-    const char *conflict_entry = NULL;
-    s_data *itt = NULL;
+	const char *conflict_entry = NULL;
+	s_data *itt = NULL;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* Do this check when this service is put in a STARTING state */
-    if (!IS_STARTING(service))
-	return (TRUE);
+	/* Do this check when this service is put in a STARTING state */
+	if (!IS_STARTING(service))
+		return (TRUE);
 
-    /* make sure the conflict entry is set */
-    while ((conflict_entry = get_next_string(&CONFLICT, service, &itt)))
-    {
-	active_db_h *s = NULL;
-
-	/*D_("Making sure that %s is not running.\n", conflict_entry); */
-	char *fixed = fix_variables(conflict_entry, service);
-
-	s = initng_active_db_find_by_name(fixed);
-
-	free(fixed);
-	/* this is actually good */
-	if (!s)
+	/* make sure the conflict entry is set */
+	while ((conflict_entry = get_next_string(&CONFLICT, service, &itt)))
 	{
-	    /*D_("Conflict not found!\n"); */
-	    continue;
-	}
+		active_db_h *s = NULL;
 
-	if (IS_UP(s) || IS_STARTING(s))
-	{
-	    initng_common_mark_service(service, &CONFLICTING);
-	    F_("Service \"%s\" is conflicting with service \"%s\"!\n",
-	       service->name, s->name);
-	    return (FALSE);
+		/*D_("Making sure that %s is not running.\n", conflict_entry); */
+		char *fixed = fix_variables(conflict_entry, service);
+
+		s = initng_active_db_find_by_name(fixed);
+
+		free(fixed);
+		/* this is actually good */
+		if (!s)
+		{
+			/*D_("Conflict not found!\n"); */
+			continue;
+		}
+
+		if (IS_UP(s) || IS_STARTING(s))
+		{
+			initng_common_mark_service(service, &CONFLICTING);
+			F_("Service \"%s\" is conflicting with service \"%s\"!\n",
+			   service->name, s->name);
+			return (FALSE);
+		}
 	}
-    }
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&CONFLICT);
-    initng_plugin_hook_add(&g.IS_CHANGE, 10, &check_conflict);
-    initng_active_state_add(&CONFLICTING);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    return (TRUE);
+	initng_service_data_types_add(&CONFLICT);
+	initng_plugin_hook_add(&g.IS_CHANGE, 10, &check_conflict);
+	initng_active_state_add(&CONFLICTING);
+
+	return (TRUE);
 }
 
 void module_unload(void)
 {
 
-    initng_plugin_hook_del(&g.IS_CHANGE, &check_conflict);
-    initng_active_state_del(&CONFLICTING);
-    initng_service_data_types_del(&CONFLICT);
+	initng_plugin_hook_del(&g.IS_CHANGE, &check_conflict);
+	initng_active_state_del(&CONFLICTING);
+	initng_service_data_types_del(&CONFLICT);
 }

Modified: initng/trunk/plugins/cpout/initng_colorprint_out.c
==============================================================================
--- initng/trunk/plugins/cpout/initng_colorprint_out.c	(original)
+++ initng/trunk/plugins/cpout/initng_colorprint_out.c	Wed Apr  5 23:11:19 2006
@@ -50,388 +50,388 @@
 
 static void clear_lastserv(void)
 {
-    if (lastservice)
-	printf("\n");
-    lastservice = NULL;
-    last_ptype = NULL;
+	if (lastservice)
+		printf("\n");
+	lastservice = NULL;
+	last_ptype = NULL;
 }
 
 
 static void out_service_done(active_db_h * s)
 {
-    int t;
+	int t;
 
-    assert(s);
-    assert(s->name);
+	assert(s);
+	assert(s->name);
 
-    t = MS_DIFF(s->time_current_state, s->time_last_state);
+	t = MS_DIFF(s->time_current_state, s->time_last_state);
 
-    clear_lastserv();
-    if (t > 1)
-    {
-	if (g.sys_state == STATE_STARTING)
-	    printf(PE "\t[" C_GREEN "done" C_OFF "]  \t( done in %ims )\n",
-		   initng_active_db_percent_started(), s->name, t);
-	else
-	    printf(P "\t[" C_GREEN "done" C_OFF "]  \t( done in %ims )\n",
-		   s->name, t);
-    }
-    else
-    {
-	if (g.sys_state == STATE_STARTING)
-	    printf(PE "\t[" C_GREEN "done" C_OFF "]\n",
-		   initng_active_db_percent_started(), s->name);
+	clear_lastserv();
+	if (t > 1)
+	{
+		if (g.sys_state == STATE_STARTING)
+			printf(PE "\t[" C_GREEN "done" C_OFF "]  \t( done in %ims )\n",
+				   initng_active_db_percent_started(), s->name, t);
+		else
+			printf(P "\t[" C_GREEN "done" C_OFF "]  \t( done in %ims )\n",
+				   s->name, t);
+	}
 	else
-	    printf(P "\t[" C_GREEN "done" C_OFF "]\n", s->name);
-    }
+	{
+		if (g.sys_state == STATE_STARTING)
+			printf(PE "\t[" C_GREEN "done" C_OFF "]\n",
+				   initng_active_db_percent_started(), s->name);
+		else
+			printf(P "\t[" C_GREEN "done" C_OFF "]\n", s->name);
+	}
 }
 
 static void opt_service_stop_p(active_db_h * s, const char *is)
 {
-    int t;
+	int t;
 
-    assert(s);
-    assert(s->name);
+	assert(s);
+	assert(s->name);
 
-    t = MS_DIFF(s->time_current_state, s->time_last_state);
+	t = MS_DIFF(s->time_current_state, s->time_last_state);
 
-    clear_lastserv();
-    if (t > 1)
-    {
-	if (g.sys_state == STATE_STOPPING)
-	    printf(PE "\t[" C_GREEN "%s" C_OFF
-		   "]\t( %s in %ims )\n", initng_active_db_percent_stopped(),
-		   s->name, is, is, t);
-	else
-	    printf(P "\t[" C_GREEN "%s" C_OFF
-		   "]\t( %s in %ims )\n", s->name, is, is, t);
-    }
-    else
-    {
-	if (g.sys_state == STATE_STOPPING)
-	    printf(PE "\t[" C_GREEN "%s" C_OFF "]\n",
-		   initng_active_db_percent_stopped(), s->name, is);
+	clear_lastserv();
+	if (t > 1)
+	{
+		if (g.sys_state == STATE_STOPPING)
+			printf(PE "\t[" C_GREEN "%s" C_OFF
+				   "]\t( %s in %ims )\n", initng_active_db_percent_stopped(),
+				   s->name, is, is, t);
+		else
+			printf(P "\t[" C_GREEN "%s" C_OFF
+				   "]\t( %s in %ims )\n", s->name, is, is, t);
+	}
 	else
-	    printf(P "\t[" C_GREEN "%s" C_OFF "]\n", s->name, is);
-    }
+	{
+		if (g.sys_state == STATE_STOPPING)
+			printf(PE "\t[" C_GREEN "%s" C_OFF "]\n",
+				   initng_active_db_percent_stopped(), s->name, is);
+		else
+			printf(P "\t[" C_GREEN "%s" C_OFF "]\n", s->name, is);
+	}
 }
 
 
 static int print_output(active_db_h * service)
 {
-    assert(service);
-    assert(service->name);
-
-    /* if quiet_when_up and system up, dont print anything */
-    if (quiet_when_up && g.sys_state == STATE_UP)
-	return (TRUE);
+	assert(service);
+	assert(service->name);
 
-    if (IS_DOWN(service))
-    {
-	opt_service_stop_p(service, "stopped");
-	return (TRUE);
-    }
-
-    if (IS_STARTING(service))
-    {
-	/* if we print this on boot, we clutter up the screen too much */
-	if (g.sys_state == STATE_STARTING)
-	    return (TRUE);
-	clear_lastserv();
-	printf(P "\t[" C_GREEN "starting" C_OFF "]\n", service->name);
-	return (TRUE);
-    }
+	/* if quiet_when_up and system up, dont print anything */
+	if (quiet_when_up && g.sys_state == STATE_UP)
+		return (TRUE);
 
-    if (IS_UP(service))
-    {
-	int t;
-	process_h *process = initng_process_db_get_by_name("daemon", service);
+	if (IS_DOWN(service))
+	{
+		opt_service_stop_p(service, "stopped");
+		return (TRUE);
+	}
 
-	if (!process)
+	if (IS_STARTING(service))
 	{
-	    out_service_done(service);
-	    return (TRUE);
+		/* if we print this on boot, we clutter up the screen too much */
+		if (g.sys_state == STATE_STARTING)
+			return (TRUE);
+		clear_lastserv();
+		printf(P "\t[" C_GREEN "starting" C_OFF "]\n", service->name);
+		return (TRUE);
 	}
-	clear_lastserv();
-	t = initng_active_db_percent_started();
 
-	if (t > 1 && g.sys_state == STATE_STARTING)
-	    printf(PE "\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
-		   t, service->name, process->pid);
-	else
-	    printf(P "\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
-		   service->name, process->pid);
+	if (IS_UP(service))
+	{
+		int t;
+		process_h *process = initng_process_db_get_by_name("daemon", service);
 
-	return (TRUE);
-    }
+		if (!process)
+		{
+			out_service_done(service);
+			return (TRUE);
+		}
+		clear_lastserv();
+		t = initng_active_db_percent_started();
 
-    if (IS_STOPPING(service))
-    {
-	/*
-	 * don't prompt that we are stopping a service, if system is shutting down, i 
-	 * do think that the user is aware about this.
-	 */
-	if (g.sys_state == STATE_STOPPING)
-	    return (TRUE);
+		if (t > 1 && g.sys_state == STATE_STARTING)
+			printf(PE "\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
+				   t, service->name, process->pid);
+		else
+			printf(P "\t[" C_GREEN "started" C_OFF "]\t( pid: %i )\n",
+				   service->name, process->pid);
 
-	clear_lastserv();
-	printf(P "\t[" C_GREEN "stopping" C_OFF "]\n", service->name);
+		return (TRUE);
+	}
 
-	return (TRUE);
-    }
+	if (IS_STOPPING(service))
+	{
+		/*
+		 * don't prompt that we are stopping a service, if system is shutting down, i 
+		 * do think that the user is aware about this.
+		 */
+		if (g.sys_state == STATE_STOPPING)
+			return (TRUE);
 
-    /* Print all states, that is a failure state */
-    if (IS_FAILED(service))
-    {
-	clear_lastserv();
-	printf(P "\t[" C_RED "%s" C_OFF "]\n", service->name,
-	       service->current_state->state_name);
-    }
-    return (TRUE);
+		clear_lastserv();
+		printf(P "\t[" C_GREEN "stopping" C_OFF "]\n", service->name);
+
+		return (TRUE);
+	}
+
+	/* Print all states, that is a failure state */
+	if (IS_FAILED(service))
+	{
+		clear_lastserv();
+		printf(P "\t[" C_RED "%s" C_OFF "]\n", service->name,
+			   service->current_state->state_name);
+	}
+	return (TRUE);
 }
 
 static void print_system_state(h_sys_state state)
 {
 
-    switch (state)
-    {
-	case STATE_STARTING:
-	    clear_lastserv();
-	    printf("\tSystem is starting up!\n\n");
-	    break;
-	case STATE_STOPPING:
-	    clear_lastserv();
-	    printf("\tSystem is going down!\n\n");
-	    break;
-	case STATE_ASE:
-	    clear_lastserv();
-	    printf("\tLast process exited!\n\n");
-	    break;
-	case STATE_EXIT:
-	    clear_lastserv();
-	    printf("\tInitng exiting!\n\n");
-	    break;
-	case STATE_RESTART:
-	    clear_lastserv();
-	    printf("\tInitng restarting!\n\n");
-	    break;
-	case STATE_REBOOT:
-	    clear_lastserv();
-	    printf("\n\tYour system will now REBOOT!\n");
-	    break;
-	case STATE_HALT:
-	    clear_lastserv();
-	    printf("\n\tYour system will now HALT!\n");
-	    break;
-	case STATE_POWEROFF:
-	    clear_lastserv();
-	    printf("\n\tYour system will now POWER_OFF!\n");
-	    break;
-	case STATE_UP:
-	    {
-		struct timeval now;
-
-		/* Dont print this */
-		if (quiet_when_up)
-		    return;
+	switch (state)
+	{
+		case STATE_STARTING:
+			clear_lastserv();
+			printf("\tSystem is starting up!\n\n");
+			break;
+		case STATE_STOPPING:
+			clear_lastserv();
+			printf("\tSystem is going down!\n\n");
+			break;
+		case STATE_ASE:
+			clear_lastserv();
+			printf("\tLast process exited!\n\n");
+			break;
+		case STATE_EXIT:
+			clear_lastserv();
+			printf("\tInitng exiting!\n\n");
+			break;
+		case STATE_RESTART:
+			clear_lastserv();
+			printf("\tInitng restarting!\n\n");
+			break;
+		case STATE_REBOOT:
+			clear_lastserv();
+			printf("\n\tYour system will now REBOOT!\n");
+			break;
+		case STATE_HALT:
+			clear_lastserv();
+			printf("\n\tYour system will now HALT!\n");
+			break;
+		case STATE_POWEROFF:
+			clear_lastserv();
+			printf("\n\tYour system will now POWER_OFF!\n");
+			break;
+		case STATE_UP:
+			{
+				struct timeval now;
+
+				/* Dont print this */
+				if (quiet_when_up)
+					return;
+
+				/* get runlevel */
+				active_db_h *runl = initng_active_db_find_by_name(g.runlevel);
+
+				if (!runl)
+				{
+					W_("Runlevel not found.\n");
+					return;
+				}
+
+				gettimeofday(&now, NULL);
+
+				clear_lastserv();
+				printf("\n\n\trunlevel \"%s\" up in, %ims.\n\n",
+					   g.runlevel, MS_DIFF(now, runl->last_rought_time));
+
+				break;
+			}
+		default:
+			break;
+	}
+	D_("print_system_state(): new system state: %i\n", state);
+}
 
-		/* get runlevel */
-		active_db_h *runl = initng_active_db_find_by_name(g.runlevel);
+static int print_program_output(active_db_h * service, process_h * x,
+								char *buffer_pos)
+{
+	/*
+	   TODO here:
+	   we should have an internal list of services and "our" current position in them.
+
+	   That way when this function is called we can print every full line from plugin_pos.
+	   This way fsck will look nice, along with an "internal" database of write positions we can cache data so we print every 5 seconds or on int forceflush.
+	 */
+	int i = 0;
 
-		if (!runl)
+	assert(service);
+	assert(service->name);
+	assert(x);
+	S_;
+
+	/* if quiet_when_up and system up, dont print anything */
+	if (quiet_when_up && g.sys_state == STATE_UP)
+		return (TRUE);
+
+	D_(" from service \"%s\"\n", service->name);
+	/*
+	   printf("buffer_pos: %i\n", buffer_pos);
+	   printf("datalen: %i\n", datalen);
+	   printf("Buffer: \n################\n%s\n##########\n\n",x->buffer);
+	 */
+	/* a first while loop that sorts out crap */
+	while (buffer_pos[i] != '\0')
+	{
+		/*  remove lines with " [2]  Done " that bash generates. */
+		if (buffer_pos[i] == '[' && buffer_pos[i + 2] == ']')
 		{
-		    W_("Runlevel not found.\n");
-		    return;
+			/* jump to next line */
+			while (buffer_pos[i] && buffer_pos[i] != '\n')
+				i++;
 		}
 
-		gettimeofday(&now, NULL);
-
-		clear_lastserv();
-		printf("\n\n\trunlevel \"%s\" up in, %ims.\n\n",
-		       g.runlevel, MS_DIFF(now, runl->last_rought_time));
+		/* if there are stupid tokens, go to next char, and run while again. */
+		if (buffer_pos[i] == ' ' || buffer_pos[i] == '\n'
+			|| buffer_pos[i] == '\t')
+		{
+			i++;
+			continue;
+		}
 
+		/* else break */
 		break;
-	    }
-	default:
-	    break;
-    }
-    D_("print_system_state(): new system state: %i\n", state);
-}
-
-static int print_program_output(active_db_h * service, process_h * x,
-				char *buffer_pos)
-{
-    /*
-       TODO here:
-       we should have an internal list of services and "our" current position in them.
-
-       That way when this function is called we can print every full line from plugin_pos.
-       This way fsck will look nice, along with an "internal" database of write positions we can cache data so we print every 5 seconds or on int forceflush.
-     */
-    int i = 0;
-
-    assert(service);
-    assert(service->name);
-    assert(x);
-    S_;
-
-    /* if quiet_when_up and system up, dont print anything */
-    if (quiet_when_up && g.sys_state == STATE_UP)
-	return (TRUE);
+	}
 
-    D_(" from service \"%s\"\n", service->name);
-    /*
-       printf("buffer_pos: %i\n", buffer_pos);
-       printf("datalen: %i\n", datalen);
-       printf("Buffer: \n################\n%s\n##########\n\n",x->buffer);
-     */
-    /* a first while loop that sorts out crap */
-    while (buffer_pos[i] != '\0')
-    {
-	/*  remove lines with " [2]  Done " that bash generates. */
-	if (buffer_pos[i] == '[' && buffer_pos[i + 2] == ']')
+	/* Make sure that there is anything left to write */
+	if (strlen(&buffer_pos[i]) < 2)
 	{
-	    /* jump to next line */
-	    while (buffer_pos[i] && buffer_pos[i] != '\n')
-		i++;
+		/* its okay anyway */
+		return (TRUE);
 	}
 
-	/* if there are stupid tokens, go to next char, and run while again. */
-	if (buffer_pos[i] == ' ' || buffer_pos[i] == '\n'
-	    || buffer_pos[i] == '\t')
-	{
-	    i++;
-	    continue;
-	}
-
-	/* else break */
-	break;
-    }
-
-    /* Make sure that there is anything left to write */
-    if (strlen(&buffer_pos[i]) < 2)
-    {
-	/* its okay anyway */
-	return (TRUE);
-    }
-
-    if (lastservice != service && last_ptype != x->pt)
-    {
-	clear_lastserv();
-	printf("\n" C_CYAN " %s %s:" C_OFF, service->name, x->pt->name);
-	/* print our special indented newline */
-	putchar('\n');
-	putchar(' ');
-	putchar(' ');
-	lastservice = service;
-	last_ptype = x->pt;
-    }
-    else
-    {
-	D_("Lastservice == service, won't print header.\n");
-    }
+	if (lastservice != service && last_ptype != x->pt)
+	{
+		clear_lastserv();
+		printf("\n" C_CYAN " %s %s:" C_OFF, service->name, x->pt->name);
+		/* print our special indented newline */
+		putchar('\n');
+		putchar(' ');
+		putchar(' ');
+		lastservice = service;
+		last_ptype = x->pt;
+	}
+	else
+	{
+		D_("Lastservice == service, won't print header.\n");
+	}
 
 
 
-    /* while buffer lasts */
-    while (buffer_pos[i] != '\0')
-    {
-	/*  remove lines with " [2]  Done " that bash generates. */
-	if (buffer_pos[i] == '[' && buffer_pos[i + 2] == ']')
+	/* while buffer lasts */
+	while (buffer_pos[i] != '\0')
 	{
-	    while (buffer_pos[i] && buffer_pos[i] != '\n')
-		i++;
-	}
+		/*  remove lines with " [2]  Done " that bash generates. */
+		if (buffer_pos[i] == '[' && buffer_pos[i + 2] == ']')
+		{
+			while (buffer_pos[i] && buffer_pos[i] != '\n')
+				i++;
+		}
 
-	/* if this are a newline */
-	if (buffer_pos[i] == '\n')
-	{
-	    /* print our special indented newline instead */
-	    putchar('\n');
-	    putchar(' ');
-	    putchar(' ');
-	    i++;
-	    /* skip spaces, on newline. */
-	    while (buffer_pos[i]
-		   && (buffer_pos[i] == ' ' || buffer_pos[i] == '\t'))
+		/* if this are a newline */
+		if (buffer_pos[i] == '\n')
+		{
+			/* print our special indented newline instead */
+			putchar('\n');
+			putchar(' ');
+			putchar(' ');
+			i++;
+			/* skip spaces, on newline. */
+			while (buffer_pos[i]
+				   && (buffer_pos[i] == ' ' || buffer_pos[i] == '\t'))
+				i++;
+			continue;
+		}
+
+		/* ok, now put the char, and go to next. */
+		putchar(buffer_pos[i]);
 		i++;
-	    continue;
 	}
 
-	/* ok, now put the char, and go to next. */
-	putchar(buffer_pos[i]);
-	i++;
-    }
-
-    /* flush any buffered output to the screen */
-    fflush(stdout);
-    return (TRUE);
+	/* flush any buffered output to the screen */
+	fflush(stdout);
+	return (TRUE);
 }
 
 
 static int cp_print_error(e_mt mt, const char *file, const char *func,
-			  int line, const char *format, va_list arg)
+						  int line, const char *format, va_list arg)
 {
-    struct tm *ts;
-    time_t t;
+	struct tm *ts;
+	time_t t;
 
-    switch (mt)
-    {
-	case MSG_FAIL:
-	case MSG_WARN:
-	    t = time(0);
-	    ts = localtime(&t);
+	switch (mt)
+	{
+		case MSG_FAIL:
+		case MSG_WARN:
+			t = time(0);
+			ts = localtime(&t);
 #ifdef DEBUG
-	    fprintf(stderr, "\n\n ** \"%s\", %s()  line:%i:\n", file, func,
-		    line);
+			fprintf(stderr, "\n\n ** \"%s\", %s()  line:%i:\n", file, func,
+					line);
 #endif
-	    fprintf(stderr, " %.2i:%.2i:%.2i -- %s:\t", ts->tm_hour,
-		    ts->tm_min, ts->tm_sec, mt == MSG_FAIL ? "FAIL" : "WARN");
-	    vfprintf(stderr, format, arg);
-	    break;
-	default:
-	    vfprintf(stderr, format, arg);
-	    break;
-    }
-    return (TRUE);
+			fprintf(stderr, " %.2i:%.2i:%.2i -- %s:\t", ts->tm_hour,
+					ts->tm_min, ts->tm_sec, mt == MSG_FAIL ? "FAIL" : "WARN");
+			vfprintf(stderr, format, arg);
+			break;
+		default:
+			vfprintf(stderr, format, arg);
+			break;
+	}
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    int i;
+	int i;
+
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+	for (i = 0; g.Argv[i]; i++)
+	{
+		if (strstr(g.Argv[i], "quiet_when_up"))
+			quiet_when_up = TRUE;
+	}
+
 
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-    for (i = 0; g.Argv[i]; i++)
-    {
-	if (strstr(g.Argv[i], "quiet_when_up"))
-	    quiet_when_up = TRUE;
-    }
-
-
-    printf("\n" C_BLUE "\tNext Generation Init version ( %s )" C_OFF,
-	   INITNG_VERSION);
-    printf("\n" C_GREEN "\thttp://initng.thinktux.net\n" C_OFF);
-    printf("\tAuthor: Jimmy Wennlund <jimmy.wennlund at gmail.com>\n");
-    printf("\tIf you find initng useful, please consider a small donation.\n\n");
-    D_("module_init();\n");
-    lastservice = NULL;
-    initng_plugin_hook_add(&g.ERR_MSG, 10, &cp_print_error);
-    initng_plugin_hook_add(&g.IS_CHANGE, 80, &print_output);
-    initng_plugin_hook_add(&g.SWATCHERS, 80, &print_system_state);
-    initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &print_program_output);
-    return (TRUE);
+	printf("\n" C_BLUE "\tNext Generation Init version ( %s )" C_OFF,
+		   INITNG_VERSION);
+	printf("\n" C_GREEN "\thttp://initng.thinktux.net\n" C_OFF);
+	printf("\tAuthor: Jimmy Wennlund <jimmy.wennlund at gmail.com>\n");
+	printf("\tIf you find initng useful, please consider a small donation.\n\n");
+	D_("module_init();\n");
+	lastservice = NULL;
+	initng_plugin_hook_add(&g.ERR_MSG, 10, &cp_print_error);
+	initng_plugin_hook_add(&g.IS_CHANGE, 80, &print_output);
+	initng_plugin_hook_add(&g.SWATCHERS, 80, &print_system_state);
+	initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &print_program_output);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("color_out: module_unload();\n");
-    initng_plugin_hook_del(&g.IS_CHANGE, &print_output);
-    initng_plugin_hook_del(&g.SWATCHERS, &print_system_state);
-    initng_plugin_hook_del(&g.PIPEWATCHERS, &print_program_output);
-    initng_plugin_hook_del(&g.ERR_MSG, &cp_print_error);
-    printf("  Goodbye\n");
+	D_("color_out: module_unload();\n");
+	initng_plugin_hook_del(&g.IS_CHANGE, &print_output);
+	initng_plugin_hook_del(&g.SWATCHERS, &print_system_state);
+	initng_plugin_hook_del(&g.PIPEWATCHERS, &print_program_output);
+	initng_plugin_hook_del(&g.ERR_MSG, &cp_print_error);
+	printf("  Goodbye\n");
 }

Modified: initng/trunk/plugins/critical/initng_critical.c
==============================================================================
--- initng/trunk/plugins/critical/initng_critical.c	(original)
+++ initng/trunk/plugins/critical/initng_critical.c	Wed Apr  5 23:11:19 2006
@@ -20,7 +20,7 @@
 #include <initng.h>
 #define _GNU_SOURCE
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 
@@ -35,65 +35,65 @@
 #include <initng_static_states.h>
 
 s_entry CRITICAL = { "critical", SET, NULL,
-    "If this option is set, and service doesn't succeed, initng will quit and offer a sulogin."
+	"If this option is set, and service doesn't succeed, initng will quit and offer a sulogin."
 };
 
 /* returns TRUE if all use deps are started */
 static int check_critical(active_db_h * service)
 {
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    if (!IS_FAILED(service))
-	return (TRUE);
-
-    if (!is(&CRITICAL, service))
-	return (TRUE);
-
-    F_("Service %s failed, this is critical, going su_login!!\n",
-       service->name);
+	if (!IS_FAILED(service))
+		return (TRUE);
 
-    initng_main_su_login();
-    /* now try to reload service from disk and run it again */
+	if (!is(&CRITICAL, service))
+		return (TRUE);
 
-    if (service->from_service)
-    {
-	list_del(&(service->from_service->list));
-	initng_service_cache_free(service->from_service);
-	service->from_service = NULL;
-    }
-
-    /* Reset the service state */
-    initng_common_mark_service(service, &NEW);
-
-    /* start the service again */
-    initng_handler_start_service(service);
-
-    /* Make sure full runlevel starting fine */
-    if (!initng_active_db_find_by_exact_name(g.runlevel))
-	if (!initng_handler_start_new_service_named(g.runlevel))
-	    F_("runlevel \"%s\" could not be executed!\n", g.runlevel);
+	F_("Service %s failed, this is critical, going su_login!!\n",
+	   service->name);
+
+	initng_main_su_login();
+	/* now try to reload service from disk and run it again */
+
+	if (service->from_service)
+	{
+		list_del(&(service->from_service->list));
+		initng_service_cache_free(service->from_service);
+		service->from_service = NULL;
+	}
+
+	/* Reset the service state */
+	initng_common_mark_service(service, &NEW);
+
+	/* start the service again */
+	initng_handler_start_service(service);
+
+	/* Make sure full runlevel starting fine */
+	if (!initng_active_db_find_by_exact_name(g.runlevel))
+		if (!initng_handler_start_new_service_named(g.runlevel))
+			F_("runlevel \"%s\" could not be executed!\n", g.runlevel);
 
-    return (FALSE);
+	return (FALSE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&CRITICAL);
-    initng_plugin_hook_add(&g.IS_CHANGE, 80, &check_critical);
-    return (TRUE);
+	initng_service_data_types_add(&CRITICAL);
+	initng_plugin_hook_add(&g.IS_CHANGE, 80, &check_critical);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&CRITICAL);
-    initng_plugin_hook_del(&g.IS_CHANGE, &check_critical);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&CRITICAL);
+	initng_plugin_hook_del(&g.IS_CHANGE, &check_critical);
 }

Modified: initng/trunk/plugins/ctrlaltdel/initng_ctrlaltdel.c
==============================================================================
--- initng/trunk/plugins/ctrlaltdel/initng_ctrlaltdel.c	(original)
+++ initng/trunk/plugins/ctrlaltdel/initng_ctrlaltdel.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 #include <signal.h>
@@ -40,34 +40,34 @@
 
 static void ctrlaltdel(int signal)
 {
-    if (signal != SIGINT)
-	return;
+	if (signal != SIGINT)
+		return;
 
-    /* what to do when there is no services left */
-    if (g.i_am_init)
-	g.when_out = THEN_REBOOT;
-    else
-	g.when_out = THEN_QUIT;
+	/* what to do when there is no services left */
+	if (g.i_am_init)
+		g.when_out = THEN_REBOOT;
+	else
+		g.when_out = THEN_QUIT;
 
-    /* stop all services */
-    initng_handler_stop_all();
+	/* stop all services */
+	initng_handler_stop_all();
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_plugin_hook_add(&g.SIGNAL, 50, &ctrlaltdel);
-    return (TRUE);
+	initng_plugin_hook_add(&g.SIGNAL, 50, &ctrlaltdel);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_plugin_hook_del(&g.SIGNAL, &ctrlaltdel);
+	D_("module_unload();\n");
+	initng_plugin_hook_del(&g.SIGNAL, &ctrlaltdel);
 }

Modified: initng/trunk/plugins/daemon/initng_daemon.c
==============================================================================
--- initng/trunk/plugins/daemon/initng_daemon.c	(original)
+++ initng/trunk/plugins/daemon/initng_daemon.c	Wed Apr  5 23:11:19 2006
@@ -23,15 +23,15 @@
 
 
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdio.h>			    /* printf() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdio.h>							/* printf() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <assert.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -40,7 +40,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <dirent.h>
-#include <ctype.h>			    /* isdigit */
+#include <ctype.h>							/* isdigit */
 
 
 #include <initng_handler.h>
@@ -145,7 +145,7 @@
  * ############################################################################
  */
 static void handle_killed_daemon(active_db_h * killed_daemon,
-				 process_h * process);
+								 process_h * process);
 
 /*
  * ############################################################################
@@ -172,28 +172,28 @@
  * The name of the process, initng should probe.
  */
 s_entry PIDOF = { "pid_of", STRING, &TYPE_DAEMON,
-    "When daemon exits, initng will look for a process with this name, and set daemon pid no to that pid."
+	"When daemon exits, initng will look for a process with this name, and set daemon pid no to that pid."
 };
 
 /*
  * The filename/path of a pidfile that initng can fetch pid no
  */
 s_entry PIDFILE = { "pid_file", STRINGS, &TYPE_DAEMON,
-    "When daemon exits, initng will get pid of daemon from this file."
+	"When daemon exits, initng will get pid of daemon from this file."
 };
 
 /*
  * If a daemon forks, and exit, but a copy is running, set the forks so we know this.
  */
 s_entry FORKS = { "forks", SET, &TYPE_DAEMON,
-    "Does the daemon fork?"
+	"Does the daemon fork?"
 };
 
 /*
  * Is set if daemon should be restarted, when it dies.
  */
 s_entry RESPAWN = { "respawn", SET, &TYPE_DAEMON,
-    "If this is set and daemon dies, it will be restarted."
+	"If this is set and daemon dies, it will be restarted."
 };
 
 
@@ -201,14 +201,14 @@
  * When respwaning, wait this many seconds before restarting the daemon.
  */
 s_entry RESPAWN_PAUSE = { "respawn_pause", INT, &TYPE_DAEMON,
-    "Wait this number of seconds before respawning."
+	"Wait this number of seconds before respawning."
 };
 
 /*
  * Minimum respawn rate, Seconds to pass sience last respawn.
  */
 s_entry RESPAWN_RATE = { "respawn_rate", INT, &TYPE_DAEMON,
-    "The minimum of seconds that this daemon must be up, to be respawned when it dies."
+	"The minimum of seconds that this daemon must be up, to be respawned when it dies."
 };
 
 /*
@@ -216,12 +216,12 @@
  * Sending the KILL signal.
  */
 s_entry TERM_TIMEOUT = { "term_timeout", INT, &TYPE_DAEMON,
-    "Wait this many seconds before KILL daemon, after a TERM."
+	"Wait this many seconds before KILL daemon, after a TERM."
 };
 
 /* A return code > 0 is ok */
 s_entry DAEMON_FAIL_OK = { "daemon_fail_ok", SET, &TYPE_DAEMON,
-    "If daemon returns a positive return code, this is till ok"
+	"If daemon returns a positive return code, this is till ok"
 };
 
 
@@ -243,14 +243,14 @@
  * When we want to start a daemon, it is first DAEMON_START_MARKED
  */
 a_state_h DAEMON_START_MARKED = { "DAEMON_START_MARKED", IS_STARTING, NULL, &init_DAEMON_START_MARKED,
-    NULL
+	NULL
 };
 
 /*
  * When we want to stop a DAEMON_RUNNING daemon, its marked SERVICE_STOP_MARKED
  */
 a_state_h DAEMON_STOP_MARKED = { "DAEMON_STOP_MARKED", IS_STOPPING, NULL, &init_DAEMON_STOP_MARKED,
-    NULL
+	NULL
 };
 
 /*
@@ -262,38 +262,38 @@
  * When daemons needed by current one is starting, current daemon is set DAEMON_WAITING_FOR_START_DEP
  */
 a_state_h DAEMON_WAITING_FOR_START_DEP = { "DAEMON_WAITING_FOR_START_DEP", IS_STARTING,
-    &handle_DAEMON_WAITING_FOR_START_DEP, NULL, NULL
+	&handle_DAEMON_WAITING_FOR_START_DEP, NULL, NULL
 };
 
 /*
  * When daemons needed to stop, before this is stopped is stopping, current daemon is set DAEMON_WAITING_FOR_STOP_DEP
  */
 a_state_h DAEMON_WAITING_FOR_STOP_DEP = { "DAEMON_WAITING_FOR_STOP_DEP", IS_STOPPING,
-    &handle_DAEMON_WAITING_FOR_STOP_DEP, NULL, NULL
+	&handle_DAEMON_WAITING_FOR_STOP_DEP, NULL, NULL
 };
 
 /*
  * This state is set, when all daemons needed to start, is started.
  */
 a_state_h DAEMON_START_DEPS_MET = { "DAEMON_START_DEPS_MET", IS_STARTING, NULL, &init_DAEMON_START_DEPS_MET,
-    NULL
+	NULL
 };
 
 /*
  * This state is set, when all daemons needed top be stopped, before stopping, is stopped.
  */
 a_state_h DAEMON_STOP_DEPS_MET = { "DAEMON_STOP_DEPS_MET", IS_STOPPING, NULL, &init_DAEMON_STOP_DEPS_MET,
-    NULL
+	NULL
 };
 
 /*
  * This is the state on the daemon, when it are being killed.
  */
 a_state_h DAEMON_KILL = { "DAEMON_KILL", IS_STOPPING, NULL, &init_DAEMON_KILL,
-    &timeout_DAEMON_KILL
+	&timeout_DAEMON_KILL
 };
 a_state_h DAEMON_TERM = { "DAEMON_TERM", IS_STOPPING, NULL, &init_DAEMON_TERM,
-    &timeout_DAEMON_TERM
+	&timeout_DAEMON_TERM
 };
 
 /*
@@ -310,14 +310,14 @@
  * In this state, the fork has return, and initng is waiting for a pidfile to appeare.
  */
 a_state_h DAEMON_WAIT_FOR_PID_FILE = { "DAEMON_WAIT_FOR_PID_FILE", IS_STARTING, NULL,
-    &init_DAEMON_WAIT_FOR_PID_FILE, &timeout_DAEMON_WAIT_FOR_PID_FILE
+	&init_DAEMON_WAIT_FOR_PID_FILE, &timeout_DAEMON_WAIT_FOR_PID_FILE
 };
 
 /*
  * This state, is when a daemon have been stopped, and its waiting for respawn timeout.
  */
 a_state_h DAEMON_WAIT_RESP_TOUT = { "WAIT_FOR_RESPAWN_TIMEOUT", IS_STARTING, NULL,
-    &init_DAEMON_WAIT_RESP_TOUT, &timeout_DAEMON_WAIT_RESP_TOUT
+	&init_DAEMON_WAIT_RESP_TOUT, &timeout_DAEMON_WAIT_RESP_TOUT
 };
 
 
@@ -341,25 +341,25 @@
 /* This are run, when initng wants to start a daemon */
 static int start_DAEMON(active_db_h * daemon_to_start)
 {
-    D_("Starting daemon %s.\n", daemon_to_start->name);
+	D_("Starting daemon %s.\n", daemon_to_start->name);
 
-    /* if its waiting for deps to stop, we can reset it running again */
-    if (IS_MARK(daemon_to_start, &DAEMON_WAITING_FOR_STOP_DEP))
-    {
-	initng_common_mark_service(daemon_to_start, &DAEMON_RUNNING);
-	return (TRUE);
-    }
+	/* if its waiting for deps to stop, we can reset it running again */
+	if (IS_MARK(daemon_to_start, &DAEMON_WAITING_FOR_STOP_DEP))
+	{
+		initng_common_mark_service(daemon_to_start, &DAEMON_RUNNING);
+		return (TRUE);
+	}
 
-    /* mark it WAITING_FOR_START_DEP and wait */
-    if (!initng_common_mark_service(daemon_to_start, &DAEMON_START_MARKED))
-    {
-	W_("mark_daemon DAEMON_START_MARKED failed for daemon %s\n",
-	   daemon_to_start->name);
-	return (FALSE);
-    }
+	/* mark it WAITING_FOR_START_DEP and wait */
+	if (!initng_common_mark_service(daemon_to_start, &DAEMON_START_MARKED))
+	{
+		W_("mark_daemon DAEMON_START_MARKED failed for daemon %s\n",
+		   daemon_to_start->name);
+		return (FALSE);
+	}
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
@@ -367,23 +367,23 @@
 static int stop_DAEMON(active_db_h * daemon)
 {
 
-    /* if its waiting for deps to start, we can set it to stopped directly */
-    if (IS_MARK(daemon, &DAEMON_WAITING_FOR_START_DEP))
-    {
-	initng_common_mark_service(daemon, &DAEMON_STOPPED);
-	return (TRUE);
-    }
+	/* if its waiting for deps to start, we can set it to stopped directly */
+	if (IS_MARK(daemon, &DAEMON_WAITING_FOR_START_DEP))
+	{
+		initng_common_mark_service(daemon, &DAEMON_STOPPED);
+		return (TRUE);
+	}
 
-    /* set stopping */
-    if (!initng_common_mark_service(daemon, &DAEMON_STOP_MARKED))
-    {
-	W_("mark_service DAEMON_STOP_MARKED failed for daemon %s.\n",
-	   daemon->name);
-	return (FALSE);
-    }
+	/* set stopping */
+	if (!initng_common_mark_service(daemon, &DAEMON_STOP_MARKED))
+	{
+		W_("mark_service DAEMON_STOP_MARKED failed for daemon %s.\n",
+		   daemon->name);
+		return (FALSE);
+	}
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
@@ -395,103 +395,103 @@
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    /* Add a new servicetype */
-    initng_service_types_add(&TYPE_DAEMON);
+	/* Add a new servicetype */
+	initng_service_types_add(&TYPE_DAEMON);
 
-    /* Add 2 new processtype */
-    initng_process_db_ptype_add(&T_DAEMON);
-    initng_process_db_ptype_add(&T_KILL);
-
-    /* Add some new variables */
-    initng_service_data_types_add(&PIDFILE);
-    initng_service_data_types_add(&PIDOF);
-    initng_service_data_types_add(&FORKS);
-    initng_service_data_types_add(&RESPAWN);
-    initng_service_data_types_add(&TERM_TIMEOUT);
-    initng_service_data_types_add(&DAEMON_FAIL_OK);
-    initng_service_data_types_add(&INTERNAL_LAST_RESPAWN);
-    initng_service_data_types_add(&RESPAWN_PAUSE);
-    initng_service_data_types_add(&RESPAWN_RATE);
-
-    /* Add some new service-states */
-    initng_active_state_add(&DAEMON_START_MARKED);
-    initng_active_state_add(&DAEMON_STOP_MARKED);
-    initng_active_state_add(&DAEMON_RUNNING);
-    initng_active_state_add(&DAEMON_WAITING_FOR_START_DEP);
-    initng_active_state_add(&DAEMON_WAITING_FOR_STOP_DEP);
-    initng_active_state_add(&DAEMON_START_DEPS_MET);
-    initng_active_state_add(&DAEMON_STOP_DEPS_MET);
-    initng_active_state_add(&DAEMON_KILL);
-    initng_active_state_add(&DAEMON_TERM);
-    initng_active_state_add(&DAEMON_STOPPED);
-    initng_active_state_add(&DAEMON_LAUNCH);
-    initng_active_state_add(&DAEMON_WAIT_FOR_PID_FILE);
-    initng_active_state_add(&DAEMON_START_DEPS_FAILED);
-    initng_active_state_add(&DAEMON_STOP_DEPS_FAILED);
-    initng_active_state_add(&DAEMON_FAIL_STARTING);
-    initng_active_state_add(&DAEMON_FAIL_STOPPING);
-    initng_active_state_add(&DAEMON_WAIT_RESP_TOUT);
-    initng_active_state_add(&DAEMON_UP_CHECK_FAILED);
-    initng_active_state_add(&DAEMON_RESPAWN_RATE_EXCEEDED);
+	/* Add 2 new processtype */
+	initng_process_db_ptype_add(&T_DAEMON);
+	initng_process_db_ptype_add(&T_KILL);
+
+	/* Add some new variables */
+	initng_service_data_types_add(&PIDFILE);
+	initng_service_data_types_add(&PIDOF);
+	initng_service_data_types_add(&FORKS);
+	initng_service_data_types_add(&RESPAWN);
+	initng_service_data_types_add(&TERM_TIMEOUT);
+	initng_service_data_types_add(&DAEMON_FAIL_OK);
+	initng_service_data_types_add(&INTERNAL_LAST_RESPAWN);
+	initng_service_data_types_add(&RESPAWN_PAUSE);
+	initng_service_data_types_add(&RESPAWN_RATE);
+
+	/* Add some new service-states */
+	initng_active_state_add(&DAEMON_START_MARKED);
+	initng_active_state_add(&DAEMON_STOP_MARKED);
+	initng_active_state_add(&DAEMON_RUNNING);
+	initng_active_state_add(&DAEMON_WAITING_FOR_START_DEP);
+	initng_active_state_add(&DAEMON_WAITING_FOR_STOP_DEP);
+	initng_active_state_add(&DAEMON_START_DEPS_MET);
+	initng_active_state_add(&DAEMON_STOP_DEPS_MET);
+	initng_active_state_add(&DAEMON_KILL);
+	initng_active_state_add(&DAEMON_TERM);
+	initng_active_state_add(&DAEMON_STOPPED);
+	initng_active_state_add(&DAEMON_LAUNCH);
+	initng_active_state_add(&DAEMON_WAIT_FOR_PID_FILE);
+	initng_active_state_add(&DAEMON_START_DEPS_FAILED);
+	initng_active_state_add(&DAEMON_STOP_DEPS_FAILED);
+	initng_active_state_add(&DAEMON_FAIL_STARTING);
+	initng_active_state_add(&DAEMON_FAIL_STOPPING);
+	initng_active_state_add(&DAEMON_WAIT_RESP_TOUT);
+	initng_active_state_add(&DAEMON_UP_CHECK_FAILED);
+	initng_active_state_add(&DAEMON_RESPAWN_RATE_EXCEEDED);
 
-    initng_plugin_hook_add(&g.ADDITIONAL_PARSE, 80,
-			   &check_valid_pidfile_path);
+	initng_plugin_hook_add(&g.ADDITIONAL_PARSE, 80,
+						   &check_valid_pidfile_path);
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    /* Remove all added states */
-    initng_active_state_del(&DAEMON_START_MARKED);
-    initng_active_state_del(&DAEMON_STOP_MARKED);
-    initng_active_state_del(&DAEMON_RUNNING);
-    initng_active_state_del(&DAEMON_WAITING_FOR_START_DEP);
-    initng_active_state_del(&DAEMON_WAITING_FOR_STOP_DEP);
-    initng_active_state_del(&DAEMON_START_DEPS_MET);
-    initng_active_state_del(&DAEMON_STOP_DEPS_MET);
-    initng_active_state_del(&DAEMON_KILL);
-    initng_active_state_del(&DAEMON_TERM);
-    initng_active_state_del(&DAEMON_STOPPED);
-    initng_active_state_del(&DAEMON_LAUNCH);
-    initng_active_state_del(&DAEMON_WAIT_FOR_PID_FILE);
-    initng_active_state_del(&DAEMON_START_DEPS_FAILED);
-    initng_active_state_del(&DAEMON_STOP_DEPS_FAILED);
-    initng_active_state_del(&DAEMON_FAIL_STARTING);
-    initng_active_state_del(&DAEMON_FAIL_STOPPING);
-    initng_active_state_del(&DAEMON_WAIT_RESP_TOUT);
-    initng_active_state_del(&DAEMON_UP_CHECK_FAILED);
-    initng_active_state_del(&DAEMON_RESPAWN_RATE_EXCEEDED);
-
-    /* Delete all added variables */
-    initng_service_data_types_del(&PIDFILE);
-    initng_service_data_types_del(&PIDOF);
-    initng_service_data_types_del(&FORKS);
-    initng_service_data_types_del(&RESPAWN);
-    initng_service_data_types_del(&TERM_TIMEOUT);
-    initng_service_data_types_del(&DAEMON_FAIL_OK);
-    initng_service_data_types_del(&INTERNAL_LAST_RESPAWN);
-    initng_service_data_types_del(&RESPAWN_PAUSE);
-    initng_service_data_types_del(&RESPAWN_RATE);
-
-    /* Delete the processstypes */
-    initng_process_db_ptype_del(&T_DAEMON);
-    initng_process_db_ptype_del(&T_KILL);
+	/* Remove all added states */
+	initng_active_state_del(&DAEMON_START_MARKED);
+	initng_active_state_del(&DAEMON_STOP_MARKED);
+	initng_active_state_del(&DAEMON_RUNNING);
+	initng_active_state_del(&DAEMON_WAITING_FOR_START_DEP);
+	initng_active_state_del(&DAEMON_WAITING_FOR_STOP_DEP);
+	initng_active_state_del(&DAEMON_START_DEPS_MET);
+	initng_active_state_del(&DAEMON_STOP_DEPS_MET);
+	initng_active_state_del(&DAEMON_KILL);
+	initng_active_state_del(&DAEMON_TERM);
+	initng_active_state_del(&DAEMON_STOPPED);
+	initng_active_state_del(&DAEMON_LAUNCH);
+	initng_active_state_del(&DAEMON_WAIT_FOR_PID_FILE);
+	initng_active_state_del(&DAEMON_START_DEPS_FAILED);
+	initng_active_state_del(&DAEMON_STOP_DEPS_FAILED);
+	initng_active_state_del(&DAEMON_FAIL_STARTING);
+	initng_active_state_del(&DAEMON_FAIL_STOPPING);
+	initng_active_state_del(&DAEMON_WAIT_RESP_TOUT);
+	initng_active_state_del(&DAEMON_UP_CHECK_FAILED);
+	initng_active_state_del(&DAEMON_RESPAWN_RATE_EXCEEDED);
+
+	/* Delete all added variables */
+	initng_service_data_types_del(&PIDFILE);
+	initng_service_data_types_del(&PIDOF);
+	initng_service_data_types_del(&FORKS);
+	initng_service_data_types_del(&RESPAWN);
+	initng_service_data_types_del(&TERM_TIMEOUT);
+	initng_service_data_types_del(&DAEMON_FAIL_OK);
+	initng_service_data_types_del(&INTERNAL_LAST_RESPAWN);
+	initng_service_data_types_del(&RESPAWN_PAUSE);
+	initng_service_data_types_del(&RESPAWN_RATE);
+
+	/* Delete the processstypes */
+	initng_process_db_ptype_del(&T_DAEMON);
+	initng_process_db_ptype_del(&T_KILL);
 
-    /* Last, delete the servicetype */
-    initng_service_types_del(&TYPE_DAEMON);
+	/* Last, delete the servicetype */
+	initng_service_types_del(&TYPE_DAEMON);
 
-    initng_plugin_hook_del(&g.ADDITIONAL_PARSE, &check_valid_pidfile_path);
+	initng_plugin_hook_del(&g.ADDITIONAL_PARSE, &check_valid_pidfile_path);
 
 }
 
@@ -508,11 +508,11 @@
 static void init_DAEMON_START_MARKED(active_db_h * daemon)
 {
 
-    /* start all our dependencies */
-    initng_depend_start_deps(daemon);
+	/* start all our dependencies */
+	initng_depend_start_deps(daemon);
 
-    /* put it in DAEMON_WAITING_FOR_START_DEP */
-    initng_common_mark_service(daemon, &DAEMON_WAITING_FOR_START_DEP);
+	/* put it in DAEMON_WAITING_FOR_START_DEP */
+	initng_common_mark_service(daemon, &DAEMON_WAITING_FOR_START_DEP);
 }
 
 /*
@@ -520,203 +520,203 @@
  */
 static void init_DAEMON_STOP_MARKED(active_db_h * daemon)
 {
-    /* stop all our dependencies */
-    initng_depend_stop_deps(daemon);
+	/* stop all our dependencies */
+	initng_depend_stop_deps(daemon);
 
-    /* put it in DAEMON_WAITING_FOR_STOP_DEP */
-    initng_common_mark_service(daemon, &DAEMON_WAITING_FOR_STOP_DEP);
+	/* put it in DAEMON_WAITING_FOR_STOP_DEP */
+	initng_common_mark_service(daemon, &DAEMON_WAITING_FOR_STOP_DEP);
 }
 
 static void handle_DAEMON_WAITING_FOR_START_DEP(active_db_h * daemon)
 {
-    assert(daemon);
+	assert(daemon);
 
 
-    /*
-     * this checks depencncy.
-     * initng_depend_start_dep_met() will return:
-     * TRUE (dep is met)
-     * FALSE (dep is not met)
-     * FAIL (dep is failed)
-     */
-    switch (initng_depend_start_dep_met(daemon, FALSE))
-    {
-	case TRUE:
-	    break;
-	case FAIL:
-	    initng_common_mark_service(daemon, &DAEMON_START_DEPS_FAILED);
-	    return;
-	default:
-	    /* return and hope that this handler will be called again. */
-	    return;
-    }
-
-    /* if system is shutting down, Don't start anything. */
-    if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
-    {
-	F_("Can't start daemon, when system status is: %i !\n", g.sys_state);
-	initng_common_mark_service(daemon, &DAEMON_STOPPED);
-	return;
-    }
+	/*
+	 * this checks depencncy.
+	 * initng_depend_start_dep_met() will return:
+	 * TRUE (dep is met)
+	 * FALSE (dep is not met)
+	 * FAIL (dep is failed)
+	 */
+	switch (initng_depend_start_dep_met(daemon, FALSE))
+	{
+		case TRUE:
+			break;
+		case FAIL:
+			initng_common_mark_service(daemon, &DAEMON_START_DEPS_FAILED);
+			return;
+		default:
+			/* return and hope that this handler will be called again. */
+			return;
+	}
 
-    /* set status to START_DEP_MET */
-    initng_common_mark_service(daemon, &DAEMON_START_DEPS_MET);
+	/* if system is shutting down, Don't start anything. */
+	if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
+	{
+		F_("Can't start daemon, when system status is: %i !\n", g.sys_state);
+		initng_common_mark_service(daemon, &DAEMON_STOPPED);
+		return;
+	}
+
+	/* set status to START_DEP_MET */
+	initng_common_mark_service(daemon, &DAEMON_START_DEPS_MET);
 
 }
 
 static void handle_DAEMON_WAITING_FOR_STOP_DEP(active_db_h * daemon)
 {
-    assert(daemon);
+	assert(daemon);
 
-    /* check with other plug-ins, if it is ok to stop this service now */
-    if (initng_depend_stop_dep_met(daemon, FALSE) != TRUE)
-	return;
+	/* check with other plug-ins, if it is ok to stop this service now */
+	if (initng_depend_stop_dep_met(daemon, FALSE) != TRUE)
+		return;
 
-    /* ok, stopping deps are met */
-    initng_common_mark_service(daemon, &DAEMON_STOP_DEPS_MET);
+	/* ok, stopping deps are met */
+	initng_common_mark_service(daemon, &DAEMON_STOP_DEPS_MET);
 }
 
 static void init_DAEMON_START_DEPS_MET(active_db_h * daemon)
 {
-    /* clear all stale pidfiles if any */
-    clear_pidfile(daemon);
+	/* clear all stale pidfiles if any */
+	clear_pidfile(daemon);
+
+	/* set the DAEMON_LAUNCH state */
+	if (!initng_common_mark_service(daemon, &DAEMON_LAUNCH))
+		return;
+
+	/*
+	 * If pidof is set, check that there is no
+	 * existing running daemon in here.
+	 */
+	if (is(&PIDOF, daemon))
+	{
+		pid_t pid = 0;
+
+		D_("getting pid by PIDOF!\n");
+		/* get pid by process name */
+		pid = get_pidof(daemon);
+		D_("result : %d\n", pid);
+
+		/* if the pid really exist on the system */
+		if (pid > 1 && kill(pid, 0) == 0)
+		{
+			/* create an new process */
+			process_h *existing_process = initng_process_db_new(&T_DAEMON);
+
+			if (existing_process)
+			{
+				W_("Daemon for service %s was already running, adding it to service daemon process list instead of starting a new one.\n", daemon->name);
+
+				/* set process status */
+				existing_process->pst = P_RUNNING;
+				existing_process->pid = pid;
+
+				/* add process */
+				initng_process_add_to_service(existing_process, daemon);
+				initng_common_mark_service(daemon, &DAEMON_RUNNING);
+				return;
+			}
+		}
+	}
 
-    /* set the DAEMON_LAUNCH state */
-    if (!initng_common_mark_service(daemon, &DAEMON_LAUNCH))
-	return;
-
-    /*
-     * If pidof is set, check that there is no
-     * existing running daemon in here.
-     */
-    if (is(&PIDOF, daemon))
-    {
-	pid_t pid = 0;
-
-	D_("getting pid by PIDOF!\n");
-	/* get pid by process name */
-	pid = get_pidof(daemon);
-	D_("result : %d\n", pid);
-
-	/* if the pid really exist on the system */
-	if (pid > 1 && kill(pid, 0) == 0)
-	{
-	    /* create an new process */
-	    process_h *existing_process = initng_process_db_new(&T_DAEMON);
-
-	    if (existing_process)
-	    {
-		W_("Daemon for service %s was already running, adding it to service daemon process list instead of starting a new one.\n", daemon->name);
-
-		/* set process status */
-		existing_process->pst = P_RUNNING;
-		existing_process->pid = pid;
-
-		/* add process */
-		initng_process_add_to_service(existing_process, daemon);
-		initng_common_mark_service(daemon, &DAEMON_RUNNING);
+
+	/* F I N A L L Y   S T A R T */
+	switch (initng_execute_launch(daemon, &T_DAEMON))
+	{
+		case FALSE:
+			F_("Did not find a service->\"daemon\" entry to run!\n",
+			   daemon->name);
+			initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
+			return;
+		case FAIL:
+			F_("Service %s, could not launch service->\"daemon\"\n",
+			   daemon->name);
+			initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
+			return;
+		default:
+			break;
+	}
+
+
+	/* if PIDFILE or PIDOF set, put daemon in WAIT_FOR_PIDFILE_STATE */
+	if (is(&PIDFILE, daemon) || is(&PIDOF, daemon))
+	{
+		initng_common_mark_service(daemon, &DAEMON_WAIT_FOR_PID_FILE);
+		return;
+	};
+
+	/* If daemon is a forking one, let it stay DAEMON_LAUNCH */
+	if (is(&FORKS, daemon))
+	{
+		D_("FORKS is set, will wait for return.\n");
 		return;
-	    }
 	}
-    }
 
+	D_("FORKS not set, setting to DAEMON_RUNNING directly.\n");
 
-    /* F I N A L L Y   S T A R T */
-    switch (initng_execute_launch(daemon, &T_DAEMON))
-    {
-	case FALSE:
-	    F_("Did not find a service->\"daemon\" entry to run!\n",
-	       daemon->name);
-	    initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
-	    return;
-	case FAIL:
-	    F_("Service %s, could not launch service->\"daemon\"\n",
-	       daemon->name);
-	    initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
-	    return;
-	default:
-	    break;
-    }
-
-
-    /* if PIDFILE or PIDOF set, put daemon in WAIT_FOR_PIDFILE_STATE */
-    if (is(&PIDFILE, daemon) || is(&PIDOF, daemon))
-    {
-	initng_common_mark_service(daemon, &DAEMON_WAIT_FOR_PID_FILE);
-	return;
-    };
-
-    /* If daemon is a forking one, let it stay DAEMON_LAUNCH */
-    if (is(&FORKS, daemon))
-    {
-	D_("FORKS is set, will wait for return.\n");
-	return;
-    }
-
-    D_("FORKS not set, setting to DAEMON_RUNNING directly.\n");
-
-    /* check with up_check */
-    if (initng_depend_up_check(daemon) != TRUE)
-    {
-	initng_common_mark_service(daemon, &DAEMON_UP_CHECK_FAILED);
-	return;
-    }
+	/* check with up_check */
+	if (initng_depend_up_check(daemon) != TRUE)
+	{
+		initng_common_mark_service(daemon, &DAEMON_UP_CHECK_FAILED);
+		return;
+	}
 
-    /* We just set it to up, as soon as it is started */
-    initng_common_mark_service(daemon, &DAEMON_RUNNING);
+	/* We just set it to up, as soon as it is started */
+	initng_common_mark_service(daemon, &DAEMON_RUNNING);
 }
 
 static void init_DAEMON_STOP_DEPS_MET(active_db_h * service)
 {
-    process_h *process = NULL;
-
-    /* find the daemon, and check so it still exits */
-    if (!(process = initng_process_db_get(&T_DAEMON, service)))
-    {
-	F_("Could not find process to kill!\n");
-	return;
-    }
-
-    /* Check so process have a valid pid */
-    if (process->pid <= 0)
-    {
-	D_("Pid is unvalid, marked as DAEMON_STOPPED\n");
-	initng_common_mark_service(service, &DAEMON_STOPPED);
-	return;
-    }
+	process_h *process = NULL;
 
-    if (kill(process->pid, 0) && errno == ESRCH)
-    {
-	D_("Dont exist a process with pid %i, mark as DAEMON_STOPPED\n",
-	   process->pid);
-	initng_common_mark_service(service, &DAEMON_STOPPED);
-	return;
-    }
+	/* find the daemon, and check so it still exits */
+	if (!(process = initng_process_db_get(&T_DAEMON, service)))
+	{
+		F_("Could not find process to kill!\n");
+		return;
+	}
 
+	/* Check so process have a valid pid */
+	if (process->pid <= 0)
+	{
+		D_("Pid is unvalid, marked as DAEMON_STOPPED\n");
+		initng_common_mark_service(service, &DAEMON_STOPPED);
+		return;
+	}
 
-    /* launch stop service */
-    switch (initng_execute_launch(service, &T_KILL))
-    {
-	case FAIL:
-	    F_("  --  (%s): fail launch stop!\n", service->name);
-	    initng_common_mark_service(service, &DAEMON_FAIL_STOPPING);
-	    return;
-	case FALSE:
-	    {
-		/* if there is no plugin that wanna kill this daemon,
-		 * we do it ourself.
-		 */
-		kill_daemon(service, SIGTERM);
-		if (!initng_common_mark_service(service, &DAEMON_TERM))
-		    return;
-		break;
-	    }
-	default:
-	    /* Set its state to GOING_KILLED, to mark that we put some effort on killing it. */
-	    if (!initng_common_mark_service(service, &DAEMON_TERM))
+	if (kill(process->pid, 0) && errno == ESRCH)
+	{
+		D_("Dont exist a process with pid %i, mark as DAEMON_STOPPED\n",
+		   process->pid);
+		initng_common_mark_service(service, &DAEMON_STOPPED);
 		return;
-	    break;
-    }
+	}
+
+
+	/* launch stop service */
+	switch (initng_execute_launch(service, &T_KILL))
+	{
+		case FAIL:
+			F_("  --  (%s): fail launch stop!\n", service->name);
+			initng_common_mark_service(service, &DAEMON_FAIL_STOPPING);
+			return;
+		case FALSE:
+			{
+				/* if there is no plugin that wanna kill this daemon,
+				 * we do it ourself.
+				 */
+				kill_daemon(service, SIGTERM);
+				if (!initng_common_mark_service(service, &DAEMON_TERM))
+					return;
+				break;
+			}
+		default:
+			/* Set its state to GOING_KILLED, to mark that we put some effort on killing it. */
+			if (!initng_common_mark_service(service, &DAEMON_TERM))
+				return;
+			break;
+	}
 
 }
 
@@ -726,8 +726,8 @@
  */
 static void init_DAEMON_WAIT_FOR_PID_FILE(active_db_h * s)
 {
-    /* Set the alarm to 1 seconds, to make a pidfile check every sec */
-    initng_handler_set_alarm(s, 1);
+	/* Set the alarm to 1 seconds, to make a pidfile check every sec */
+	initng_handler_set_alarm(s, 1);
 }
 
 /*
@@ -737,33 +737,33 @@
  */
 static void timeout_DAEMON_WAIT_FOR_PID_FILE(active_db_h * s)
 {
-    /* check if timeout have appeared */
-    if (g.now.tv_sec > s->time_current_state.tv_sec + PID_TIMEOUT)
-    {
-	process_h *process = NULL;
+	/* check if timeout have appeared */
+	if (g.now.tv_sec > s->time_current_state.tv_sec + PID_TIMEOUT)
+	{
+		process_h *process = NULL;
 
-	F_("Service \"%s\" wait for pidfile timed out! Will kill daemon now.\n", s->name);
+		F_("Service \"%s\" wait for pidfile timed out! Will kill daemon now.\n", s->name);
 
-	initng_common_mark_service(s, &DAEMON_FAIL_STARTING);
-	kill_daemon(s, SIGKILL);
+		initng_common_mark_service(s, &DAEMON_FAIL_STARTING);
+		kill_daemon(s, SIGKILL);
 
-	/* Free the process if found */
-	if ((process = initng_process_db_get(&T_DAEMON, s)))
+		/* Free the process if found */
+		if ((process = initng_process_db_get(&T_DAEMON, s)))
+		{
+			list_del(&process->list);
+			initng_process_db_free(process);
+		}
+		return;
+	}
+
+	/*
+	 * NOW, start check for a pid
+	 */
+	if (!try_get_pid(s))
 	{
-	    list_del(&process->list);
-	    initng_process_db_free(process);
-	}
-	return;
-    }
-
-    /*
-     * NOW, start check for a pid
-     */
-    if (!try_get_pid(s))
-    {
-	/* try again in 1 second */
-	initng_handler_set_alarm(s, 1);
-    }
+		/* try again in 1 second */
+		initng_handler_set_alarm(s, 1);
+	}
 }
 
 
@@ -773,70 +773,70 @@
  */
 static void init_DAEMON_WAIT_RESP_TOUT(active_db_h * service)
 {
-    int respawn_pause = DEFAULT_RESPAWN_PAUSE;
+	int respawn_pause = DEFAULT_RESPAWN_PAUSE;
 
-    /* if RESPAWN_PAUSE set */
-    if (is(&RESPAWN_PAUSE, service))
-    {
-	/* get it */
-	respawn_pause = get_int(&RESPAWN_PAUSE, service);
-    }
+	/* if RESPAWN_PAUSE set */
+	if (is(&RESPAWN_PAUSE, service))
+	{
+		/* get it */
+		respawn_pause = get_int(&RESPAWN_PAUSE, service);
+	}
 
-    D_("Will sleep %i seconds before respawning!\n", respawn_pause);
-    initng_handler_set_alarm(service, respawn_pause);
+	D_("Will sleep %i seconds before respawning!\n", respawn_pause);
+	initng_handler_set_alarm(service, respawn_pause);
 }
 
 /* When respawn timeout is out, reset service and start it */
 static void timeout_DAEMON_WAIT_RESP_TOUT(active_db_h * service)
 {
-    /* If set it stopped, so it can be restarted */
-    initng_common_mark_service(service, &DAEMON_STOPPED);
+	/* If set it stopped, so it can be restarted */
+	initng_common_mark_service(service, &DAEMON_STOPPED);
 
-    /* to make sure it will be started */
-    initng_handler_start_service(service);
+	/* to make sure it will be started */
+	initng_handler_start_service(service);
 }
 
 
 /* set timeout */
 static void init_DAEMON_TERM(active_db_h * daemon)
 {
-    int timeout;
+	int timeout;
 
-    /* get the TERM_TIMEOUT */
-    timeout = get_int(&TERM_TIMEOUT, daemon);
+	/* get the TERM_TIMEOUT */
+	timeout = get_int(&TERM_TIMEOUT, daemon);
 
-    /* Make sure we got an value */
-    if (timeout == 0)
-	timeout = DEFAULT_TERM_TIMEOUT;
+	/* Make sure we got an value */
+	if (timeout == 0)
+		timeout = DEFAULT_TERM_TIMEOUT;
 
-    initng_handler_set_alarm(daemon, timeout);
+	initng_handler_set_alarm(daemon, timeout);
 }
 
 /* when DAEMON_TERM timeout, kill it instead */
 static void timeout_DAEMON_TERM(active_db_h * daemon)
 {
-    F_("Service %s TERM_TIMEOUT reached!, sending KILL signal.\n",
-       daemon->name);
-    kill_daemon(daemon, SIGKILL);
+	F_("Service %s TERM_TIMEOUT reached!, sending KILL signal.\n",
+	   daemon->name);
+	kill_daemon(daemon, SIGKILL);
 
-    /* Set it to DAEMON_KILL state, monitoring that TERM signal is sent. */
-    initng_common_mark_service(daemon, &DAEMON_KILL);
+	/* Set it to DAEMON_KILL state, monitoring that TERM signal is sent. */
+	initng_common_mark_service(daemon, &DAEMON_KILL);
 }
 
 /* set timeout when a service sets to state DAEMON_KILL */
 static void init_DAEMON_KILL(active_db_h * daemon)
 {
-    initng_handler_set_alarm(daemon, DEFAULT_KILL_TIMEOUT);
+	initng_handler_set_alarm(daemon, DEFAULT_KILL_TIMEOUT);
 }
 
 /* set SIGKILL on every timeout */
 static void timeout_DAEMON_KILL(active_db_h * daemon)
 {
-    F_("Service %s KILL_TIMEOUT of %i seconds reached! (%i seconds passed), sending another KILL signal.\n", daemon->name, DEFAULT_KILL_TIMEOUT, g.now.tv_sec - daemon->time_current_state.tv_sec);
-    kill_daemon(daemon, SIGKILL);
+	F_("Service %s KILL_TIMEOUT of %i seconds reached! (%i seconds passed), sending another KILL signal.\n", daemon->name, DEFAULT_KILL_TIMEOUT, g.now.tv_sec - daemon->time_current_state.tv_sec);
+	kill_daemon(daemon, SIGKILL);
 
-    /* Dont be afraid to kill again */
-    initng_handler_set_alarm(daemon, DEFAULT_KILL_TIMEOUT);
+	/* Dont be afraid to kill again */
+	initng_handler_set_alarm(daemon, DEFAULT_KILL_TIMEOUT);
 }
 
 /*
@@ -847,67 +847,67 @@
 
 static void handle_killed_daemon(active_db_h * daemon, process_h * process)
 {
-    assert(daemon);
-    assert(daemon->name);
-    assert(daemon->current_state);
-    assert(daemon->current_state->state_name);
-    assert(process);
-
-    D_("handle_killed_start(%s): initial status: \"%s\".\n",
-       daemon->name, daemon->current_state->state_name);
-
-    /*
-     * If the return code (for example "exit 1", in a bash script)
-     * from the program, is bigger than 0, this commonly signalize
-     * that something got wrong, print this as an error msg on screen
-     */
-    if (process->r_code > 0)
-    {
-	F_(" start %s, Returned with exit %i.\n", daemon->name,
-	   process->r_code);
-    }
-
-
-    /*
-     * Youst run if we checks for PID FILE
-     */
-    if (daemon->current_state == &DAEMON_WAIT_FOR_PID_FILE &&
-	is(&FORKS, daemon))
-    {
-	try_get_pid(daemon);
-	return;
-    }
-
-    /* This service are gonna respawn, no need to set it stopped */
-    if (check_respawn(daemon))
-    {
-	/* It is gonna respawn, free this process and forget */
-	list_del(&process->list);
-	initng_process_db_free(process);
+	assert(daemon);
+	assert(daemon->name);
+	assert(daemon->current_state);
+	assert(daemon->current_state->state_name);
+	assert(process);
+
+	D_("handle_killed_start(%s): initial status: \"%s\".\n",
+	   daemon->name, daemon->current_state->state_name);
+
+	/*
+	 * If the return code (for example "exit 1", in a bash script)
+	 * from the program, is bigger than 0, this commonly signalize
+	 * that something got wrong, print this as an error msg on screen
+	 */
+	if (process->r_code > 0)
+	{
+		F_(" start %s, Returned with exit %i.\n", daemon->name,
+		   process->r_code);
+	}
 
-	return;
-    }
 
-    /*
-     * Make sure r_code don't signal error (can be override by UP_ON_FAILURE.
-     */
-
-    /*   TODO              MAKE UP_ON_FAILURE more universal */
-    if (process->r_code && !is(&DAEMON_FAIL_OK, daemon))
-    {
+	/*
+	 * Youst run if we checks for PID FILE
+	 */
+	if (daemon->current_state == &DAEMON_WAIT_FOR_PID_FILE &&
+		is(&FORKS, daemon))
+	{
+		try_get_pid(daemon);
+		return;
+	}
 
-	initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
-	list_del(&process->list);
-	initng_process_db_free(process);
-	return;
-    }
+	/* This service are gonna respawn, no need to set it stopped */
+	if (check_respawn(daemon))
+	{
+		/* It is gonna respawn, free this process and forget */
+		list_del(&process->list);
+		initng_process_db_free(process);
+
+		return;
+	}
+
+	/*
+	 * Make sure r_code don't signal error (can be override by UP_ON_FAILURE.
+	 */
+
+	/*   TODO              MAKE UP_ON_FAILURE more universal */
+	if (process->r_code && !is(&DAEMON_FAIL_OK, daemon))
+	{
+
+		initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
 
-    /* OK! now daemon is STOPPED! */
-    initng_common_mark_service(daemon, &DAEMON_STOPPED);
+	/* OK! now daemon is STOPPED! */
+	initng_common_mark_service(daemon, &DAEMON_STOPPED);
 
-    /* free the process struct, to spare memory */
-    list_del(&process->list);
-    initng_process_db_free(process);
+	/* free the process struct, to spare memory */
+	list_del(&process->list);
+	initng_process_db_free(process);
 }
 
 /*
@@ -919,44 +919,44 @@
 
 static void kill_daemon(active_db_h * service, int sig)
 {
-    process_h *process = NULL;
+	process_h *process = NULL;
 
-    assert(service);
+	assert(service);
 
-    /* make sure we got a process */
-    if (!(process = initng_process_db_get(&T_DAEMON, service)))
-    {
-	F_("Service doesn't have any processes, don't know how to kill then.\n");
-	return;
-    }
-
-    /* check so that pid is good */
-    if (process->pid <= 0)
-    {
-	F_("Bad PID %d in database!\n", process->pid);
-	list_del(&process->list);
-	initng_process_db_free(process);
-	return;
-    }
+	/* make sure we got a process */
+	if (!(process = initng_process_db_get(&T_DAEMON, service)))
+	{
+		F_("Service doesn't have any processes, don't know how to kill then.\n");
+		return;
+	}
 
-    /* check so there exits an process with this pid */
-    if (kill(process->pid, 0) && errno == ESRCH)
-    {
-	F_("Trying to kill a service (%s) with a pid (%d), but there exists no process with this pid!\n", service->name, process->pid);
-	list_del(&process->list);
-	initng_process_db_free(process);
-	return;
-    }
+	/* check so that pid is good */
+	if (process->pid <= 0)
+	{
+		F_("Bad PID %d in database!\n", process->pid);
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
 
-    /* if system is not stopping, generate a warning */
-    /*if (g.sys_state != STATE_STOPPING)
-       {
-       W_(" Sending the process %i of %s, the SIGTERM signal!\n",
-       process->pid, service->name);
-       } */
+	/* check so there exits an process with this pid */
+	if (kill(process->pid, 0) && errno == ESRCH)
+	{
+		F_("Trying to kill a service (%s) with a pid (%d), but there exists no process with this pid!\n", service->name, process->pid);
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
 
-    /* Uhm, this doesn't work : kill(-service->start_process->pid, SIGKILL); */
-    kill(process->pid, sig);
+	/* if system is not stopping, generate a warning */
+	/*if (g.sys_state != STATE_STOPPING)
+	   {
+	   W_(" Sending the process %i of %s, the SIGTERM signal!\n",
+	   process->pid, service->name);
+	   } */
+
+	/* Uhm, this doesn't work : kill(-service->start_process->pid, SIGKILL); */
+	kill(process->pid, sig);
 }
 
 /*
@@ -967,95 +967,95 @@
  */
 static pid_t pid_of(const char *name)
 {
-    DIR *dir;
-    struct dirent *d;
-    FILE *fp;
+	DIR *dir;
+	struct dirent *d;
+	FILE *fp;
 
-    /* maximum possible length for string "/proc/12232/stat" can be */
+	/* maximum possible length for string "/proc/12232/stat" can be */
 #define BUFF_SIZE 512
 
-    D_("Will fetch pid of \"%s\"\n", name);
+	D_("Will fetch pid of \"%s\"\n", name);
 
-    /* Open /proc or fail */
-    if (!(dir = opendir("/proc")))
-	return (-1);
+	/* Open /proc or fail */
+	if (!(dir = opendir("/proc")))
+		return (-1);
 
-    /* Walk through the directory. */
-    while ((d = readdir(dir)) != NULL)
-    {
-	char buf[BUFF_SIZE + 1];	/* Will contain a fixed string like "/proc/12232/stat" */
-	char *s = NULL;		/* Temporary pointer when parsing the content of the stat file */
-	int len = 0;		/* An length counter */
-	pid_t pid = -1;		/* Will contain the pid to return */
-
-	/* Make sure this dirname is a number == pid */
-	if ((pid = atoi(d->d_name)) <= 0)
-	    continue;
-
-	/* Fix a string, that matches the full path of the stat file */
-	snprintf(buf, BUFF_SIZE, "/proc/%d/stat", pid);
-	D_("To open: %s\n", buf);
-
-	/* Read SID & statname from it or fail */
-	if (!(fp = fopen(buf, "r")))
-	{
-	    W_("Could not open %s.\n", buf);
-	    continue;
-	}
-
-	/* fetch the full stat file, or fail */
-	if (fgets(buf, BUFF_SIZE, fp) == NULL)
+	/* Walk through the directory. */
+	while ((d = readdir(dir)) != NULL)
 	{
-	    fclose(fp);
-	    continue;
+		char buf[BUFF_SIZE + 1];	/* Will contain a fixed string like "/proc/12232/stat" */
+		char *s = NULL;			/* Temporary pointer when parsing the content of the stat file */
+		int len = 0;			/* An length counter */
+		pid_t pid = -1;			/* Will contain the pid to return */
+
+		/* Make sure this dirname is a number == pid */
+		if ((pid = atoi(d->d_name)) <= 0)
+			continue;
+
+		/* Fix a string, that matches the full path of the stat file */
+		snprintf(buf, BUFF_SIZE, "/proc/%d/stat", pid);
+		D_("To open: %s\n", buf);
+
+		/* Read SID & statname from it or fail */
+		if (!(fp = fopen(buf, "r")))
+		{
+			W_("Could not open %s.\n", buf);
+			continue;
+		}
+
+		/* fetch the full stat file, or fail */
+		if (fgets(buf, BUFF_SIZE, fp) == NULL)
+		{
+			fclose(fp);
+			continue;
+		}
+
+		/* close stat file */
+		fclose(fp);
+
+		/* set the walk counter, to the start of the file content fetched */
+		s = buf;
+
+		/* skip all chars to the first space - first string contains the pid no */
+		while (*s && *s != ' ')
+			s++;
+
+		/* Make sure we have any data */
+		if (*s == '\0')
+			continue;
+
+		/* skip the space */
+		s++;
+
+		/* skip the '(' char */
+		if (*s != '(')
+			continue;
+		s++;
+
+		/* count the length */
+		while (s[len] && s[len] != ')')
+			len++;
+
+		/* compare the name in the '(' ')' chars with the process name we are looking for */
+		if (strncmp(s, name, len) == 0)
+		{
+			D_("Found %s with pid %d\n", name, pid);
+
+			/* make sure the dir (/proc) is closed. */
+			if (dir)
+				closedir(dir);
+
+			/* return happily with the pid */
+			return (pid);
+		}
 	}
 
-	/* close stat file */
-	fclose(fp);
-
-	/* set the walk counter, to the start of the file content fetched */
-	s = buf;
-
-	/* skip all chars to the first space - first string contains the pid no */
-	while (*s && *s != ' ')
-	    s++;
-
-	/* Make sure we have any data */
-	if (*s == '\0')
-	    continue;
-
-	/* skip the space */
-	s++;
-
-	/* skip the '(' char */
-	if (*s != '(')
-	    continue;
-	s++;
-
-	/* count the length */
-	while (s[len] && s[len] != ')')
-	    len++;
-
-	/* compare the name in the '(' ')' chars with the process name we are looking for */
-	if (strncmp(s, name, len) == 0)
-	{
-	    D_("Found %s with pid %d\n", name, pid);
-
-	    /* make sure the dir (/proc) is closed. */
-	    if (dir)
+	/* close the dir (/proc) if still open */
+	if (dir)
 		closedir(dir);
 
-	    /* return happily with the pid */
-	    return (pid);
-	}
-    }
-
-    /* close the dir (/proc) if still open */
-    if (dir)
-	closedir(dir);
-
-    D_("Did not find a process with name \"%s\"\n", name);
-    return (-1);
+	D_("Did not find a process with name \"%s\"\n", name);
+	return (-1);
 }
 
 
@@ -1066,138 +1066,138 @@
  */
 static pid_t pid_from_file(const char *name)
 {
-    unsigned int i = 0;
-    pid_t ret = 0;
-    int fd = 0;
-    unsigned int len = 0;
-    char buf[21];
-
-    assert(name);
-
-    /* open pid file */
-    fd = open(name, O_RDONLY);
-
-    /* If we cant open pidfile, this is bad */
-    if (fd == -1)
-	return (-1);
-
-    /* Read data from buffer */
-    len = read(fd, buf, 20);
-    close(fd);
-    if (len < 1)
-    {
-	F_("Read 0 chars from %s, It's empty.\n", name);
-	return (-1);
-    }
+	unsigned int i = 0;
+	pid_t ret = 0;
+	int fd = 0;
+	unsigned int len = 0;
+	char buf[21];
+
+	assert(name);
+
+	/* open pid file */
+	fd = open(name, O_RDONLY);
+
+	/* If we cant open pidfile, this is bad */
+	if (fd == -1)
+		return (-1);
+
+	/* Read data from buffer */
+	len = read(fd, buf, 20);
+	close(fd);
+	if (len < 1)
+	{
+		F_("Read 0 chars from %s, It's empty.\n", name);
+		return (-1);
+	}
 
-    for (i = 0; i < len && !isdigit(buf[i]); i++) ;
+	for (i = 0; i < len && !isdigit(buf[i]); i++) ;
 
-    for (; i < len && isdigit(buf[i]); i++)
-	ret = ret * 10 - '0' + buf[i];
+	for (; i < len && isdigit(buf[i]); i++)
+		ret = ret * 10 - '0' + buf[i];
 
-    if (!ret && i > len)
-	F_("bufferoverrun: no pid fetched from '%s'.", name);
-    else if (ret && i > len)
-	F_("bufferoverrun: the pid received from '%s' is pid (%i).", name,
-	   ret);
+	if (!ret && i > len)
+		F_("bufferoverrun: no pid fetched from '%s'.", name);
+	else if (ret && i > len)
+		F_("bufferoverrun: the pid received from '%s' is pid (%i).", name,
+		   ret);
 
-    return ret;
+	return ret;
 }
 
 static pid_t get_pidof(active_db_h * s)
 {
-    pid_t pid;
-    const char *pidof;
-    char *pidof_fixed = NULL;
-
-    pidof = get_string(&PIDOF, s);
-    if (!pidof)
-	return (-1);
-
-
-    pidof_fixed = fix_variables(pidof, s);
-    if (!pidof_fixed)
-	return (-1);
-
-    pid = pid_of(pidof_fixed);
-    free(pidof_fixed);
-    return (pid);
+	pid_t pid;
+	const char *pidof;
+	char *pidof_fixed = NULL;
+
+	pidof = get_string(&PIDOF, s);
+	if (!pidof)
+		return (-1);
+
+
+	pidof_fixed = fix_variables(pidof, s);
+	if (!pidof_fixed)
+		return (-1);
+
+	pid = pid_of(pidof_fixed);
+	free(pidof_fixed);
+	return (pid);
 }
 
 /* this will get the pid of PIDFILE entry of service */
 static pid_t get_pidfile(active_db_h * s)
 {
-    pid_t pid;
-    const char *pidfile = NULL;
-    char *pidfile_fixed = NULL;
-    s_data *itt = NULL;
-
-    /* get the pidfile */
-    while ((pidfile = get_next_string(&PIDFILE, s, &itt)))
-    {
-	/* fix the variables in the string */
-	pidfile_fixed = fix_variables(pidfile, s);
-
-	/* check so we got the string */
-	if (!pidfile_fixed)
-	    return (-1);
-
-	/* make sure the first char is a '/' so its a full path */
-	if (pidfile_fixed[0] != '/')
-	{
-	    F_("%s has pid_file with relative path \"%s\"\n", s->name,
-	       pidfile_fixed);
-	    /* check_valid_pidfile_path() can detect certain dangerous
-	       typos, but it can't prevent loading. Stop to be safe */
-	    free(pidfile_fixed);
-	    return (-1);
-	}
-
-	/* get the pid from the file */
-	pid = pid_from_file(pidfile_fixed);
-	free(pidfile_fixed);
-
-	/* return the pid */
-	if (pid > 1)
-	    return (pid);
-    }
-    return (-1);
+	pid_t pid;
+	const char *pidfile = NULL;
+	char *pidfile_fixed = NULL;
+	s_data *itt = NULL;
+
+	/* get the pidfile */
+	while ((pidfile = get_next_string(&PIDFILE, s, &itt)))
+	{
+		/* fix the variables in the string */
+		pidfile_fixed = fix_variables(pidfile, s);
+
+		/* check so we got the string */
+		if (!pidfile_fixed)
+			return (-1);
+
+		/* make sure the first char is a '/' so its a full path */
+		if (pidfile_fixed[0] != '/')
+		{
+			F_("%s has pid_file with relative path \"%s\"\n", s->name,
+			   pidfile_fixed);
+			/* check_valid_pidfile_path() can detect certain dangerous
+			   typos, but it can't prevent loading. Stop to be safe */
+			free(pidfile_fixed);
+			return (-1);
+		}
+
+		/* get the pid from the file */
+		pid = pid_from_file(pidfile_fixed);
+		free(pidfile_fixed);
+
+		/* return the pid */
+		if (pid > 1)
+			return (pid);
+	}
+	return (-1);
 }
 
 static void clear_pidfile(active_db_h * s)
 {
-    const char *pidfile = NULL;
-    char *pidfile_fixed = NULL;
-    s_data *itt = NULL;
-
-    /* ok, search for pidfiles */
-    while ((pidfile = get_next_string(&PIDFILE, s, &itt)))
-    {
-	if (pidfile)
-	{
-	    /* fix the variables in the string */
-	    pidfile_fixed = fix_variables(pidfile, s);
-
-	    /* check it's an absolute path after variable substitution */
-	    if (pidfile_fixed[0] == '/')
-	    {
-		if (unlink(pidfile_fixed) != 0 && errno != ENOENT)
-		    F_("Could not remove stale pidfile \"%s\"\n",
-		       pidfile_fixed);
-		break;
-	    }
-	    else
-	    {
-		F_("%s has pid_file with relative path \"%s\"\n", s->name,
-		   pidfile_fixed);
-		/* check_valid_pidfile_path() can detect certain dangerous
-		   typos, but it can't prevent loading. Stop to be safe */
-		free(pidfile_fixed);
-		return;
-	    }
-	    free(pidfile_fixed);
+	const char *pidfile = NULL;
+	char *pidfile_fixed = NULL;
+	s_data *itt = NULL;
+
+	/* ok, search for pidfiles */
+	while ((pidfile = get_next_string(&PIDFILE, s, &itt)))
+	{
+		if (pidfile)
+		{
+			/* fix the variables in the string */
+			pidfile_fixed = fix_variables(pidfile, s);
+
+			/* check it's an absolute path after variable substitution */
+			if (pidfile_fixed[0] == '/')
+			{
+				if (unlink(pidfile_fixed) != 0 && errno != ENOENT)
+					F_("Could not remove stale pidfile \"%s\"\n",
+					   pidfile_fixed);
+				break;
+			}
+			else
+			{
+				F_("%s has pid_file with relative path \"%s\"\n", s->name,
+				   pidfile_fixed);
+				/* check_valid_pidfile_path() can detect certain dangerous
+				   typos, but it can't prevent loading. Stop to be safe */
+				free(pidfile_fixed);
+				return;
+			}
+			free(pidfile_fixed);
+		}
 	}
-    }
 }
 
 /* Chack pid_file path is reasonable - mainly to protect against
@@ -1206,19 +1206,19 @@
    the daemon with the problem from being loaded and started! */
 static int check_valid_pidfile_path(service_cache_h * s)
 {
-    const char *pidfile = NULL;
-    s_data *itt = NULL;
+	const char *pidfile = NULL;
+	s_data *itt = NULL;
 
-    while ((pidfile = get_next_string(&PIDFILE, s, &itt)))
-    {
-	if (pidfile && pidfile[0] != '/' && pidfile[0] != '$')
-	{
-	    F_("%s has pid_file with relative path \"%s\"\n", s->name,
-	       pidfile);
-	    return FALSE;
+	while ((pidfile = get_next_string(&PIDFILE, s, &itt)))
+	{
+		if (pidfile && pidfile[0] != '/' && pidfile[0] != '$')
+		{
+			F_("%s has pid_file with relative path \"%s\"\n", s->name,
+			   pidfile);
+			return FALSE;
+		}
 	}
-    }
-    return TRUE;
+	return TRUE;
 }
 
 /*
@@ -1234,54 +1234,54 @@
  */
 static int check_respawn(active_db_h * service)
 {
-    time_t last = 0;
-    int respawn_rate = DEFAULT_RESPAWN_RATE;
+	time_t last = 0;
+	int respawn_rate = DEFAULT_RESPAWN_RATE;
 
-    assert(service);
+	assert(service);
 
-    /* Check so service status is DAEMON_RUNNING, or it wont have stopped by it self */
-    if (!IS_MARK(service, &DAEMON_RUNNING))
-	return (FALSE);
+	/* Check so service status is DAEMON_RUNNING, or it wont have stopped by it self */
+	if (!IS_MARK(service, &DAEMON_RUNNING))
+		return (FALSE);
 
-    /* check if the service have respawn enabled */
-    if (!is(&RESPAWN, service))
-    {
-	D_("Service %s doesn't have RESPAWN flag set, won't respawn!\n");
-	return (FALSE);
-    }
+	/* check if the service have respawn enabled */
+	if (!is(&RESPAWN, service))
+	{
+		D_("Service %s doesn't have RESPAWN flag set, won't respawn!\n");
+		return (FALSE);
+	}
 
-    /* get times */
-    if (is(&INTERNAL_LAST_RESPAWN, service))
-	last = (time_t) get_int(&INTERNAL_LAST_RESPAWN, service);
-    D_("Now: %i , Last: %i\n", g.now.tv_sec, last);
+	/* get times */
+	if (is(&INTERNAL_LAST_RESPAWN, service))
+		last = (time_t) get_int(&INTERNAL_LAST_RESPAWN, service);
+	D_("Now: %i , Last: %i\n", g.now.tv_sec, last);
 
-    /* get respawn_rate if set */
-    if (is(&RESPAWN_RATE, service))
-    {
-	respawn_rate = get_int(&RESPAWN_RATE, service);
-    }
+	/* get respawn_rate if set */
+	if (is(&RESPAWN_RATE, service))
+	{
+		respawn_rate = get_int(&RESPAWN_RATE, service);
+	}
 
-    /* make sure it wont respawn to often */
-    if (last && (respawn_rate > 0))
-    {
-	/* if times pased is less then respawn_rate */
-	if ((g.now.tv_sec - last) < respawn_rate)
+	/* make sure it wont respawn to often */
+	if (last && (respawn_rate > 0))
 	{
-	    W_("Won't respawn service %s, it was respawned %i seconds ago.\n",
-	       service->name, g.now.tv_sec - last);
+		/* if times pased is less then respawn_rate */
+		if ((g.now.tv_sec - last) < respawn_rate)
+		{
+			W_("Won't respawn service %s, it was respawned %i seconds ago.\n",
+			   service->name, g.now.tv_sec - last);
 
-	    initng_common_mark_service(service,
-				       &DAEMON_RESPAWN_RATE_EXCEEDED);
+			initng_common_mark_service(service,
+									   &DAEMON_RESPAWN_RATE_EXCEEDED);
 
-	    return (FALSE);
+			return (FALSE);
+		}
 	}
-    }
 
-    /* set the next INTERNAL_LAST_RESPAWN no to use. */
-    set_int(&INTERNAL_LAST_RESPAWN, service, (int) g.now.tv_sec);
+	/* set the next INTERNAL_LAST_RESPAWN no to use. */
+	set_int(&INTERNAL_LAST_RESPAWN, service, (int) g.now.tv_sec);
 
-    initng_common_mark_service(service, &DAEMON_WAIT_RESP_TOUT);
-    return (TRUE);
+	initng_common_mark_service(service, &DAEMON_WAIT_RESP_TOUT);
+	return (TRUE);
 }
 
 /*
@@ -1289,67 +1289,67 @@
  */
 static int try_get_pid(active_db_h * s)
 {
-    pid_t pid = -1;
+	pid_t pid = -1;
 
-    D_("Trying to get pid of %s\n", s->name);
+	D_("Trying to get pid of %s\n", s->name);
 
-    /* Try get the pid from PIDOF is set */
-    if (is(&PIDOF, s))
-    {
-	D_("getting pid by PIDOF!\n");
-	/* get pid by process name */
-	pid = get_pidof(s);
-	D_("result : %d\n", pid);
-    }
-    /* Try get the pid from PIDFILE if set */
-    else if (is(&PIDFILE, s))
-    {
-	D_("getting pid by PIDFILE!\n");
-	pid = get_pidfile(s);
-	D_("result : %d\n", pid);
-    }
-    else
-    {
-	F_("No one of PIDOF or PIDFILE are set, but initng is waiting for a pid.\n");
-	return (FALSE);
-    }
-
-    /* check if a process with that pid exits in the system */
-    if (pid > 0 && kill(pid, 0) < 0 && (errno == ESRCH))
-    {
-	F_("Got a non-existent pid %i for daemon \"%s\", maybe there is a stale pidfile around.", pid, s->name);
-	pid = -1;			    /* reset */
-    }
-    else if (pid > 0)
-    {
-	process_h *p = NULL;
-
-	/* get the process to handle */
-	if (!(p = initng_process_db_get(&T_DAEMON, s)))
-	{
-	    F_("Did not find a daemon process on this service!\n");
-	    initng_common_mark_service(s, &DAEMON_FAIL_STARTING);
-	    return (FALSE);
-	}
-
-	/* finally set the new pid - but not if forks=no, because
-	   that can cause problems */
-	if (is(&FORKS, s))
-	    p->pid = pid;
+	/* Try get the pid from PIDOF is set */
+	if (is(&PIDOF, s))
+	{
+		D_("getting pid by PIDOF!\n");
+		/* get pid by process name */
+		pid = get_pidof(s);
+		D_("result : %d\n", pid);
+	}
+	/* Try get the pid from PIDFILE if set */
+	else if (is(&PIDFILE, s))
+	{
+		D_("getting pid by PIDFILE!\n");
+		pid = get_pidfile(s);
+		D_("result : %d\n", pid);
+	}
+	else
+	{
+		F_("No one of PIDOF or PIDFILE are set, but initng is waiting for a pid.\n");
+		return (FALSE);
+	}
 
-	/* check with up_check */
-	if (initng_depend_up_check(s) != TRUE)
+	/* check if a process with that pid exits in the system */
+	if (pid > 0 && kill(pid, 0) < 0 && (errno == ESRCH))
 	{
-	    initng_common_mark_service(s, &DAEMON_UP_CHECK_FAILED);
-	    return (FALSE);
+		F_("Got a non-existent pid %i for daemon \"%s\", maybe there is a stale pidfile around.", pid, s->name);
+		pid = -1;							/* reset */
 	}
+	else if (pid > 0)
+	{
+		process_h *p = NULL;
 
+		/* get the process to handle */
+		if (!(p = initng_process_db_get(&T_DAEMON, s)))
+		{
+			F_("Did not find a daemon process on this service!\n");
+			initng_common_mark_service(s, &DAEMON_FAIL_STARTING);
+			return (FALSE);
+		}
+
+		/* finally set the new pid - but not if forks=no, because
+		   that can cause problems */
+		if (is(&FORKS, s))
+			p->pid = pid;
+
+		/* check with up_check */
+		if (initng_depend_up_check(s) != TRUE)
+		{
+			initng_common_mark_service(s, &DAEMON_UP_CHECK_FAILED);
+			return (FALSE);
+		}
 
-	/* set the new state */
-	initng_common_mark_service(s, &DAEMON_RUNNING);
 
-	/* return HAPPILY */
-	return (TRUE);
-    }
-    return (FALSE);
+		/* set the new state */
+		initng_common_mark_service(s, &DAEMON_RUNNING);
+
+		/* return HAPPILY */
+		return (TRUE);
+	}
+	return (FALSE);
 }

Modified: initng/trunk/plugins/daemon/test/test_pidfile.c
==============================================================================
--- initng/trunk/plugins/daemon/test/test_pidfile.c	(original)
+++ initng/trunk/plugins/daemon/test/test_pidfile.c	Wed Apr  5 23:11:19 2006
@@ -6,38 +6,38 @@
 
 static void set_pid_file(void)
 {
-    FILE *fd;
+	FILE *fd;
 
-    fd = fopen(PIDFILE, "w+");
-    if (!fd)
-    {
-	printf("Could not open " PIDFILE " for writing!\n");
-	return;
-    }
-    fprintf(fd, "%i", getpid());
-    fclose(fd);
+	fd = fopen(PIDFILE, "w+");
+	if (!fd)
+	{
+		printf("Could not open " PIDFILE " for writing!\n");
+		return;
+	}
+	fprintf(fd, "%i", getpid());
+	fclose(fd);
 }
 
 int main(int argc, char **argv)
 {
-    (void) argc;
-    (void) argv;
-    printf("This is a testing daemon pid %i, that will fork and leave pid in "
-	   PIDFILE ". \n", getpid());
-
-
-    if (fork() == 0)
-    {
-	printf("This is fork, pid %i\n", getpid());
-	printf("Setting pid now!\n");
-	set_pid_file();
-	sleep(20);
-	printf("Child will now die!\n");
-	unlink(PIDFILE);
-	_exit(1);
-    }
-
-    sleep(1);
-    printf("Fork launched!\n");
-    return (0);
+	(void) argc;
+	(void) argv;
+	printf("This is a testing daemon pid %i, that will fork and leave pid in "
+		   PIDFILE ". \n", getpid());
+
+
+	if (fork() == 0)
+	{
+		printf("This is fork, pid %i\n", getpid());
+		printf("Setting pid now!\n");
+		set_pid_file();
+		sleep(20);
+		printf("Child will now die!\n");
+		unlink(PIDFILE);
+		_exit(1);
+	}
+
+	sleep(1);
+	printf("Fork launched!\n");
+	return (0);
 }

Modified: initng/trunk/plugins/daemon_clean/initng_daemon_clean.c
==============================================================================
--- initng/trunk/plugins/daemon_clean/initng_daemon_clean.c	(original)
+++ initng/trunk/plugins/daemon_clean/initng_daemon_clean.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 #include <time.h>
@@ -43,38 +43,38 @@
 
 static int on_kill(active_db_h * s, process_h * p)
 {
-    if (strcmp(p->pt->name, "daemon") != 0)
-	return (FALSE);
+	if (strcmp(p->pt->name, "daemon") != 0)
+		return (FALSE);
 
-    /* start the T_DAEMON_CLEAN */
-    W_("%s %s has been killed!, executing DAEMON_CLEAN!\n", p->pt->name,
-       s->name);
-    initng_execute_launch(s, &T_DAEMON_CLEAN);
-
-    /*
-     * if we return TRUE, other kill handlers wont get this signal, 
-     * it means that this signal have been handled.
-     */
-    return (FALSE);
+	/* start the T_DAEMON_CLEAN */
+	W_("%s %s has been killed!, executing DAEMON_CLEAN!\n", p->pt->name,
+	   s->name);
+	initng_execute_launch(s, &T_DAEMON_CLEAN);
+
+	/*
+	 * if we return TRUE, other kill handlers wont get this signal, 
+	 * it means that this signal have been handled.
+	 */
+	return (FALSE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_process_db_ptype_add(&T_DAEMON_CLEAN);
-    initng_plugin_hook_add(&g.HANDLE_KILLED, 5, &on_kill);
-    return (TRUE);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_process_db_ptype_add(&T_DAEMON_CLEAN);
+	initng_plugin_hook_add(&g.HANDLE_KILLED, 5, &on_kill);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_plugin_hook_del(&g.HANDLE_KILLED, &on_kill);
-    initng_process_db_ptype_del(&T_DAEMON_CLEAN);
+	D_("module_unload();\n");
+	initng_plugin_hook_del(&g.HANDLE_KILLED, &on_kill);
+	initng_process_db_ptype_del(&T_DAEMON_CLEAN);
 }

Modified: initng/trunk/plugins/dbus_event/dbus_nge.c
==============================================================================
--- initng/trunk/plugins/dbus_event/dbus_nge.c	(original)
+++ initng/trunk/plugins/dbus_event/dbus_nge.c	Wed Apr  5 23:11:19 2006
@@ -11,223 +11,223 @@
  */
 int main(int argc, char **argv)
 {
-    DBusMessage *msg;
-    DBusMessageIter args;
-    DBusConnection *conn;
-    DBusError err;
-    int ret;
-
-    printf("Listening for initng-events\n");
-
-    /* initialise the errors */
-    dbus_error_init(&err);
-
-    /* connect to the bus and check for errors */
-    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
-    if (dbus_error_is_set(&err))
-    {
-	fprintf(stderr, "Connection Error (%s)\n", err.message);
-	dbus_error_free(&err);
-    }
-    if (NULL == conn)
-    {
-	exit(1);
-    }
-
-    /* request our name on the bus and check for errors */
-    ret = dbus_bus_request_name(conn, SINK_REQUEST,
-				DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
-    if (dbus_error_is_set(&err))
-    {
-	fprintf(stderr, "Name Error (%s)\n", err.message);
-	dbus_error_free(&err);
-    }
-    if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
-    {
-	exit(1);
-    }
-
-    /* add a rule for which messages we want to see */
-    dbus_bus_add_match(conn, "type='signal',interface='" INTERFACE "'", &err);	/* see signals from the given interface */
-    dbus_connection_flush(conn);
-    if (dbus_error_is_set(&err))
-    {
-	fprintf(stderr, "Match Error (%s)\n", err.message);
-	exit(1);
-    }
-
-    /* loop listening for signals being emmitted */
-    while (true)
-    {
-
-	/* non blocking read of the next available message */
-	dbus_connection_read_write(conn, 0);
-	msg = dbus_connection_pop_message(conn);
-
-	/* loop again if we haven't read a message */
-	if (NULL == msg)
-	{
-	    sleep(1);
-	    continue;
-	}
-
-
-	if (dbus_message_is_signal(msg, INTERFACE, "astatus_change"))
-	{
-	    char *service = NULL;
-	    int is = 0;
-	    char *state = NULL;
-
-	    /* read the parameters */
-	    if (!dbus_message_iter_init(msg, &args))
-		fprintf(stderr, "Message Has No Parameters\n");
-
-	    /* First interator is a string with service name */
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+	DBusMessage *msg;
+	DBusMessageIter args;
+	DBusConnection *conn;
+	DBusError err;
+	int ret;
+
+	printf("Listening for initng-events\n");
+
+	/* initialise the errors */
+	dbus_error_init(&err);
+
+	/* connect to the bus and check for errors */
+	conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+	if (dbus_error_is_set(&err))
+	{
+		fprintf(stderr, "Connection Error (%s)\n", err.message);
+		dbus_error_free(&err);
+	}
+	if (NULL == conn)
+	{
 		exit(1);
+	}
 
-	    dbus_message_iter_get_basic(&args, &service);
-
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
+	/* request our name on the bus and check for errors */
+	ret = dbus_bus_request_name(conn, SINK_REQUEST,
+								DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
+	if (dbus_error_is_set(&err))
+	{
+		fprintf(stderr, "Name Error (%s)\n", err.message);
+		dbus_error_free(&err);
+	}
+	if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
+	{
 		exit(1);
+	}
 
-	    /* Second value is an int */
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
+	/* add a rule for which messages we want to see */
+	dbus_bus_add_match(conn, "type='signal',interface='" INTERFACE "'", &err);	/* see signals from the given interface */
+	dbus_connection_flush(conn);
+	if (dbus_error_is_set(&err))
+	{
+		fprintf(stderr, "Match Error (%s)\n", err.message);
 		exit(1);
+	}
 
-	    dbus_message_iter_get_basic(&args, &is);
+	/* loop listening for signals being emmitted */
+	while (true)
+	{
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+		/* non blocking read of the next available message */
+		dbus_connection_read_write(conn, 0);
+		msg = dbus_connection_pop_message(conn);
 
-	    /* Third arg is a string, with state name */
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
+		/* loop again if we haven't read a message */
+		if (NULL == msg)
+		{
+			sleep(1);
+			continue;
+		}
 
-	    dbus_message_iter_get_basic(&args, &state);
 
+		if (dbus_message_is_signal(msg, INTERFACE, "astatus_change"))
+		{
+			char *service = NULL;
+			int is = 0;
+			char *state = NULL;
 
-	    printf(" astatus_change service: \"%s\" is: \"%i\" state: \"%s\"\n", service, is, state);
-	}
+			/* read the parameters */
+			if (!dbus_message_iter_init(msg, &args))
+				fprintf(stderr, "Message Has No Parameters\n");
 
-	if (dbus_message_is_signal(msg, INTERFACE, "system_state_change"))
-	{
-	    int sys_state = 0;
+			/* First interator is a string with service name */
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
 
-	    /* read the parameters */
-	    if (!dbus_message_iter_init(msg, &args))
-		fprintf(stderr, "Message Has No Parameters\n");
+			dbus_message_iter_get_basic(&args, &service);
 
-	    /* Second value is an int */
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
-		exit(1);
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
 
+			/* Second value is an int */
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
+				exit(1);
 
-	    printf(" system_state_change state: %i\n", sys_state);
-	}
+			dbus_message_iter_get_basic(&args, &is);
 
-	if (dbus_message_is_signal(msg, INTERFACE, "system_output"))
-	{
-	    char *service = NULL;
-	    char *process = NULL;
-	    char *output = NULL;
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
 
-	    /* read the parameters */
-	    if (!dbus_message_iter_init(msg, &args))
-		fprintf(stderr, "Message Has No Parameters\n");
+			/* Third arg is a string, with state name */
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
 
-	    /* First interator is a string with service name */
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
+			dbus_message_iter_get_basic(&args, &state);
 
-	    dbus_message_iter_get_basic(&args, &service);
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+			printf(" astatus_change service: \"%s\" is: \"%i\" state: \"%s\"\n", service, is, state);
+		}
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
+		if (dbus_message_is_signal(msg, INTERFACE, "system_state_change"))
+		{
+			int sys_state = 0;
 
-	    dbus_message_iter_get_basic(&args, &process);
+			/* read the parameters */
+			if (!dbus_message_iter_init(msg, &args))
+				fprintf(stderr, "Message Has No Parameters\n");
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+			/* Second value is an int */
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
+				exit(1);
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
 
-	    dbus_message_iter_get_basic(&args, &output);
+			printf(" system_state_change state: %i\n", sys_state);
+		}
 
+		if (dbus_message_is_signal(msg, INTERFACE, "system_output"))
+		{
+			char *service = NULL;
+			char *process = NULL;
+			char *output = NULL;
 
-	    printf(" system_output service: %s process: %s \n%s\n", service,
-		   process, output);
-	}
+			/* read the parameters */
+			if (!dbus_message_iter_init(msg, &args))
+				fprintf(stderr, "Message Has No Parameters\n");
 
-	if (dbus_message_is_signal(msg, INTERFACE, "print_error"))
-	{
-	    int mt = 0;
-	    char *file = NULL;
-	    char *func = NULL;
-	    int line = 0;
-	    char *message = NULL;
+			/* First interator is a string with service name */
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
 
-	    /* read the parameters */
-	    if (!dbus_message_iter_init(msg, &args))
-		fprintf(stderr, "Message Has No Parameters\n");
+			dbus_message_iter_get_basic(&args, &service);
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
-		exit(1);
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
 
-	    dbus_message_iter_get_basic(&args, &mt);
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+			dbus_message_iter_get_basic(&args, &process);
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
 
-	    dbus_message_iter_get_basic(&args, &file);
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+			dbus_message_iter_get_basic(&args, &output);
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
 
-	    dbus_message_iter_get_basic(&args, &func);
+			printf(" system_output service: %s process: %s \n%s\n", service,
+				   process, output);
+		}
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+		if (dbus_message_is_signal(msg, INTERFACE, "print_error"))
+		{
+			int mt = 0;
+			char *file = NULL;
+			char *func = NULL;
+			int line = 0;
+			char *message = NULL;
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
-		exit(1);
+			/* read the parameters */
+			if (!dbus_message_iter_init(msg, &args))
+				fprintf(stderr, "Message Has No Parameters\n");
 
-	    dbus_message_iter_get_basic(&args, &line);
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
+				exit(1);
 
-	    /* go to next iter */
-	    if (!dbus_message_iter_next(&args))
-		exit(1);
+			dbus_message_iter_get_basic(&args, &mt);
 
-	    if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
-		exit(1);
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
 
-	    dbus_message_iter_get_basic(&args, &message);
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
 
-	    printf(" system_output service: mt: %i file: %s func: %s line: %i\n%s\n", mt, file, func, line, message);
-	}
+			dbus_message_iter_get_basic(&args, &file);
+
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
+
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
+
+			dbus_message_iter_get_basic(&args, &func);
+
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
+
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_INT32)
+				exit(1);
 
+			dbus_message_iter_get_basic(&args, &line);
 
-	/* free the message */
-	dbus_message_unref(msg);
-    }
+			/* go to next iter */
+			if (!dbus_message_iter_next(&args))
+				exit(1);
+
+			if (dbus_message_iter_get_arg_type(&args) != DBUS_TYPE_STRING)
+				exit(1);
+
+			dbus_message_iter_get_basic(&args, &message);
+
+			printf(" system_output service: mt: %i file: %s func: %s line: %i\n%s\n", mt, file, func, line, message);
+		}
+
+
+		/* free the message */
+		dbus_message_unref(msg);
+	}
 
-    /* close the connection */
-    dbus_connection_close(conn);
+	/* close the connection */
+	dbus_connection_close(conn);
 }

Modified: initng/trunk/plugins/dbus_event/initng_dbusevent.c
==============================================================================
--- initng/trunk/plugins/dbus_event/initng_dbusevent.c	(original)
+++ initng/trunk/plugins/dbus_event/initng_dbusevent.c	Wed Apr  5 23:11:19 2006
@@ -67,9 +67,9 @@
 static int connect_to_dbus(void);
 static void system_state_change(e_is state);
 static int system_pipe_watchers(active_db_h * service, process_h * process,
-				char *output);
+								char *output);
 static int print_error(e_mt mt, const char *file, const char *func, int line,
-		       const char *format, va_list arg);
+					   const char *format, va_list arg);
 
 static dbus_bool_t add_dbus_watch(DBusWatch * watch, void *data);
 static void rem_dbus_watch(DBusWatch * watch, void *data);
@@ -82,8 +82,8 @@
 
 typedef struct initng_dbus_watch
 {
-    f_module_h fdw;
-    DBusWatch *dbus;
+	f_module_h fdw;
+	DBusWatch *dbus;
 } initng_dbus_watch;
 
 /* ------  DBus Watch Handling --------
@@ -94,276 +94,276 @@
 
 static dbus_bool_t add_dbus_watch(DBusWatch * watch, void *data)
 {
-    initng_dbus_watch *w = i_calloc(1, sizeof(initng_dbus_watch));
+	initng_dbus_watch *w = i_calloc(1, sizeof(initng_dbus_watch));
 
-    if (w == NULL)
-    {
-	printf("Memory allocation failed\n");
-	return FALSE;
-    }
+	if (w == NULL)
+	{
+		printf("Memory allocation failed\n");
+		return FALSE;
+	}
 
-    w->fdw.fds = dbus_watch_get_fd(watch);
-    w->fdw.call_module = fdw_callback;
-    w->dbus = watch;
-    w->fdw.what = 0;
+	w->fdw.fds = dbus_watch_get_fd(watch);
+	w->fdw.call_module = fdw_callback;
+	w->dbus = watch;
+	w->fdw.what = 0;
 
-    dbus_watch_set_data(watch, w, free_dbus_watch_data);
-    toggled_dbus_watch(watch, data);	    /* to set initial state */
+	dbus_watch_set_data(watch, w, free_dbus_watch_data);
+	toggled_dbus_watch(watch, data);		/* to set initial state */
 
-    initng_plugin_hook_add(&g.FDWATCHERS, 30, &w->fdw);
+	initng_plugin_hook_add(&g.FDWATCHERS, 30, &w->fdw);
 
-    return TRUE;
+	return TRUE;
 }
 
 static void rem_dbus_watch(DBusWatch * watch, void *data)
 {
-    /*   initng_dbus_watch *w = dbus_watch_get_data(watch);
+	/*   initng_dbus_watch *w = dbus_watch_get_data(watch);
 
-       if(w != NULL) free_dbus_watch_data(w); */
+	   if(w != NULL) free_dbus_watch_data(w); */
 }
 
 static void toggled_dbus_watch(DBusWatch * watch, void *data)
 {
-    initng_dbus_watch *w = dbus_watch_get_data(watch);
+	initng_dbus_watch *w = dbus_watch_get_data(watch);
 
-    w->fdw.what = 0;
-    if (dbus_watch_get_enabled(watch))
-    {
-	int flags = dbus_watch_get_flags(watch);
+	w->fdw.what = 0;
+	if (dbus_watch_get_enabled(watch))
+	{
+		int flags = dbus_watch_get_flags(watch);
 
-	if (flags & DBUS_WATCH_READABLE)
-	    w->fdw.what |= FDW_READ;
+		if (flags & DBUS_WATCH_READABLE)
+			w->fdw.what |= FDW_READ;
 
-	if (flags & DBUS_WATCH_WRITABLE)
-	    w->fdw.what |= FDW_WRITE;
+		if (flags & DBUS_WATCH_WRITABLE)
+			w->fdw.what |= FDW_WRITE;
 
-	w->fdw.what |= FDW_ERROR;
-    }
+		w->fdw.what |= FDW_ERROR;
+	}
 
 }
 
 static void free_dbus_watch_data(void *data)
 {
-    initng_dbus_watch *w = data;
+	initng_dbus_watch *w = data;
 
-    assert(w);
-    initng_plugin_hook_del(&g.FDWATCHERS, &(w->fdw));
-    free(w);
+	assert(w);
+	initng_plugin_hook_del(&g.FDWATCHERS, &(w->fdw));
+	free(w);
 }
 
 static void fdw_callback(f_module_h * from, e_fdw what)
 {
-    initng_dbus_watch *w = (initng_dbus_watch *) from;
-    int flgs = 0;
+	initng_dbus_watch *w = (initng_dbus_watch *) from;
+	int flgs = 0;
 
-    /* TODO - handle DBUS_WATCH_HANGUP ? */
+	/* TODO - handle DBUS_WATCH_HANGUP ? */
 
-    if (what & FDW_READ)
-	flgs |= DBUS_WATCH_READABLE;
+	if (what & FDW_READ)
+		flgs |= DBUS_WATCH_READABLE;
 
-    if (what & FDW_WRITE)
-	flgs |= DBUS_WATCH_WRITABLE;
+	if (what & FDW_WRITE)
+		flgs |= DBUS_WATCH_WRITABLE;
 
-    if (what & FDW_ERROR)
-	flgs |= DBUS_WATCH_ERROR;
+	if (what & FDW_ERROR)
+		flgs |= DBUS_WATCH_ERROR;
 
-    dbus_watch_handle(w->dbus, flgs);
+	dbus_watch_handle(w->dbus, flgs);
 }
 
 /* --- End DBus watch handling ---- */
 
 static int astatus_change(active_db_h * service)
 {
-    DBusMessage *msg;
-    dbus_uint32_t serial = 0;
+	DBusMessage *msg;
+	dbus_uint32_t serial = 0;
 
-    /* these values will be send */
-    const char *service_name = service->name;
-    int is = service->current_state->is;
-    const char *state_name = service->current_state->state_name;
-
-    if (conn == NULL)
-	return (TRUE);
-
-    D_("Sending signal with value \"%.10s\" %i \"%.10s\"\n", service_name, is,
-       state_name);
-
-    /* create a signal & check for errors */
-    msg = dbus_message_new_signal(OBJECT,   /* object name of the signal */
-				  INTERFACE,	/* interface name of the signal */
-				  "astatus_change");	/* name of the signal */
-    if (NULL == msg)
-    {
-	F_("Unable to create ne dbus signal\n");
-	return (TRUE);
-    }
+	/* these values will be send */
+	const char *service_name = service->name;
+	int is = service->current_state->is;
+	const char *state_name = service->current_state->state_name;
+
+	if (conn == NULL)
+		return (TRUE);
+
+	D_("Sending signal with value \"%.10s\" %i \"%.10s\"\n", service_name, is,
+	   state_name);
+
+	/* create a signal & check for errors */
+	msg = dbus_message_new_signal(OBJECT,	/* object name of the signal */
+								  INTERFACE,	/* interface name of the signal */
+								  "astatus_change");	/* name of the signal */
+	if (NULL == msg)
+	{
+		F_("Unable to create ne dbus signal\n");
+		return (TRUE);
+	}
+
+
+	/* Append some arguments to the call */
+	if (!dbus_message_append_args
+		(msg, DBUS_TYPE_STRING, &service_name, DBUS_TYPE_INT32, &is,
+		 DBUS_TYPE_STRING, &state_name, DBUS_TYPE_INVALID))
+	{
+		F_("Unable to append args to dbus signal!\n");
+		return (TRUE);
+	}
+
+
+	/* send the message and flush the connection */
+	if (!dbus_connection_send(conn, msg, &serial))
+	{
+		F_("Unable to send dbus signal!\n");
+		return (TRUE);
+	}
+	// dbus_connection_flush(conn);
 
+	D_("Dbus Signal Sent\n");
 
-    /* Append some arguments to the call */
-    if (!dbus_message_append_args
-	(msg, DBUS_TYPE_STRING, &service_name, DBUS_TYPE_INT32, &is,
-	 DBUS_TYPE_STRING, &state_name, DBUS_TYPE_INVALID))
-    {
-	F_("Unable to append args to dbus signal!\n");
-	return (TRUE);
-    }
-
+	/* free the message */
+	dbus_message_unref(msg);
 
-    /* send the message and flush the connection */
-    if (!dbus_connection_send(conn, msg, &serial))
-    {
-	F_("Unable to send dbus signal!\n");
 	return (TRUE);
-    }
-    // dbus_connection_flush(conn);
-
-    D_("Dbus Signal Sent\n");
-
-    /* free the message */
-    dbus_message_unref(msg);
-
-    return (TRUE);
 }
 
 static void system_state_change(e_is state)
 {
-    DBusMessage *msg;
-    dbus_uint32_t serial = 0;
+	DBusMessage *msg;
+	dbus_uint32_t serial = 0;
 
-    if (conn == NULL)
-	return;
-
-    /* create a signal & check for errors */
-    msg = dbus_message_new_signal(OBJECT,   /* object name of the signal */
-				  INTERFACE,	/* interface name of the signal */
-				  "system_state_change");	/* name of the signal */
-    if (NULL == msg)
-    {
-	F_("Unable to create new dbus signal\n");
-	return;
-    }
+	if (conn == NULL)
+		return;
 
+	/* create a signal & check for errors */
+	msg = dbus_message_new_signal(OBJECT,	/* object name of the signal */
+								  INTERFACE,	/* interface name of the signal */
+								  "system_state_change");	/* name of the signal */
+	if (NULL == msg)
+	{
+		F_("Unable to create new dbus signal\n");
+		return;
+	}
+
+
+	/* Append some arguments to the call */
+	if (!dbus_message_append_args
+		(msg, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID))
+	{
+		F_("Unable to append args to dbus signal!\n");
+		return;
+	}
+
+
+	/* send the message and flush the connection */
+	if (!dbus_connection_send(conn, msg, &serial))
+	{
+		F_("Unable to send dbus signal!\n");
+		return;
+	}
+	//dbus_connection_flush(conn);
 
-    /* Append some arguments to the call */
-    if (!dbus_message_append_args
-	(msg, DBUS_TYPE_INT32, &state, DBUS_TYPE_INVALID))
-    {
-	F_("Unable to append args to dbus signal!\n");
-	return;
-    }
-
+	/* free the message */
+	dbus_message_unref(msg);
 
-    /* send the message and flush the connection */
-    if (!dbus_connection_send(conn, msg, &serial))
-    {
-	F_("Unable to send dbus signal!\n");
+	D_("Dbus Signal Sent\n");
 	return;
-    }
-    //dbus_connection_flush(conn);
-
-    /* free the message */
-    dbus_message_unref(msg);
-
-    D_("Dbus Signal Sent\n");
-    return;
 }
 
 static int system_pipe_watchers(active_db_h * service, process_h * process,
-				char *output)
+								char *output)
 {
-    DBusMessage *msg;
-    dbus_uint32_t serial = 0;
-    const char *service_name = service->name;
-    const char *process_name = process->pt->name;
+	DBusMessage *msg;
+	dbus_uint32_t serial = 0;
+	const char *service_name = service->name;
+	const char *process_name = process->pt->name;
+
+	if (conn == NULL)
+		return (TRUE);
+
+	/* create a signal & check for errors */
+	msg = dbus_message_new_signal(OBJECT,	/* object name of the signal */
+								  INTERFACE,	/* interface name of the signal */
+								  "system_output");	/* name of the signal */
+	if (NULL == msg)
+	{
+		F_("Unable to create new dbus signal\n");
+		return (TRUE);
+	}
+
+
+	/* Append some arguments to the call */
+	if (!dbus_message_append_args
+		(msg, DBUS_TYPE_STRING, &service_name, DBUS_TYPE_STRING,
+		 &process_name, DBUS_TYPE_STRING, &output, DBUS_TYPE_INVALID))
+	{
+		F_("Unable to append args to dbus signal!\n");
+		return (TRUE);
+	}
+
+
+	/* send the message and flush the connection */
+	if (!dbus_connection_send(conn, msg, &serial))
+	{
+		F_("Unable to send dbus signal!\n");
+		return (TRUE);
+	}
+	//dbus_connection_flush(conn);
 
-    if (conn == NULL)
-	return (TRUE);
+	/* free the message */
+	dbus_message_unref(msg);
 
-    /* create a signal & check for errors */
-    msg = dbus_message_new_signal(OBJECT,   /* object name of the signal */
-				  INTERFACE,	/* interface name of the signal */
-				  "system_output");	/* name of the signal */
-    if (NULL == msg)
-    {
-	F_("Unable to create new dbus signal\n");
+	D_("Dbus Signal Sent\n");
 	return (TRUE);
-    }
-
-
-    /* Append some arguments to the call */
-    if (!dbus_message_append_args
-	(msg, DBUS_TYPE_STRING, &service_name, DBUS_TYPE_STRING,
-	 &process_name, DBUS_TYPE_STRING, &output, DBUS_TYPE_INVALID))
-    {
-	F_("Unable to append args to dbus signal!\n");
-	return (TRUE);
-    }
-
-
-    /* send the message and flush the connection */
-    if (!dbus_connection_send(conn, msg, &serial))
-    {
-	F_("Unable to send dbus signal!\n");
-	return (TRUE);
-    }
-    //dbus_connection_flush(conn);
-
-    /* free the message */
-    dbus_message_unref(msg);
-
-    D_("Dbus Signal Sent\n");
-    return (TRUE);
 }
 
 static int print_error(e_mt mt, const char *file, const char *func,
-		       int line, const char *format, va_list arg)
+					   int line, const char *format, va_list arg)
 {
-    DBusMessage *msg;
-    dbus_uint32_t serial = 0;
-
-    if (conn == NULL)
-	return (TRUE);
-
-    /* create a signal & check for errors */
-    msg = dbus_message_new_signal(OBJECT,   /* object name of the signal */
-				  INTERFACE,	/* interface name of the signal */
-				  "print_error");	/* name of the signal */
-    if (NULL == msg)
-    {
-	F_("Unable to create new dbus signal\n");
-	return (TRUE);
-    }
+	DBusMessage *msg;
+	dbus_uint32_t serial = 0;
 
-    /* compose the message */
-    char *message = i_calloc(1001, sizeof(char));
+	if (conn == NULL)
+		return (TRUE);
 
-    vsnprintf(message, 1000, format, arg);
+	/* create a signal & check for errors */
+	msg = dbus_message_new_signal(OBJECT,	/* object name of the signal */
+								  INTERFACE,	/* interface name of the signal */
+								  "print_error");	/* name of the signal */
+	if (NULL == msg)
+	{
+		F_("Unable to create new dbus signal\n");
+		return (TRUE);
+	}
+
+	/* compose the message */
+	char *message = i_calloc(1001, sizeof(char));
+
+	vsnprintf(message, 1000, format, arg);
+
+	/* Append some arguments to the call */
+	if (!dbus_message_append_args
+		(msg, DBUS_TYPE_INT32, &mt, DBUS_TYPE_STRING, &file, DBUS_TYPE_STRING,
+		 &func, DBUS_TYPE_INT32, &line, DBUS_TYPE_STRING, &message,
+		 DBUS_TYPE_INVALID))
+	{
+		F_("Unable to append args to dbus signal!\n");
+		return (TRUE);
+	}
+
+
+	/* send the message and flush the connection */
+	if (!dbus_connection_send(conn, msg, &serial))
+	{
+		F_("Unable to send dbus signal!\n");
+		return (TRUE);
+	}
+	//dbus_connection_flush(conn);
+
+	/* free the message */
+	dbus_message_unref(msg);
+	free(message);
 
-    /* Append some arguments to the call */
-    if (!dbus_message_append_args
-	(msg, DBUS_TYPE_INT32, &mt, DBUS_TYPE_STRING, &file, DBUS_TYPE_STRING,
-	 &func, DBUS_TYPE_INT32, &line, DBUS_TYPE_STRING, &message,
-	 DBUS_TYPE_INVALID))
-    {
-	F_("Unable to append args to dbus signal!\n");
+	D_("Dbus Signal Sent\n");
 	return (TRUE);
-    }
-
-
-    /* send the message and flush the connection */
-    if (!dbus_connection_send(conn, msg, &serial))
-    {
-	F_("Unable to send dbus signal!\n");
-	return (TRUE);
-    }
-    //dbus_connection_flush(conn);
-
-    /* free the message */
-    dbus_message_unref(msg);
-    free(message);
-
-    D_("Dbus Signal Sent\n");
-    return (TRUE);
 }
 
 
@@ -372,87 +372,87 @@
  */
 static void check_socket(int signal)
 {
-    /* only react on a SIGHUP signal */
-    if (signal != SIGHUP)
-	return;
-
-    /* close if open */
-    if (conn)
-    {
-	dbus_connection_close(conn);
-	conn = NULL;
-    }
+	/* only react on a SIGHUP signal */
+	if (signal != SIGHUP)
+		return;
+
+	/* close if open */
+	if (conn)
+	{
+		dbus_connection_close(conn);
+		conn = NULL;
+	}
 
-    /* and open again */
-    connect_to_dbus();
+	/* and open again */
+	connect_to_dbus();
 }
 
 
 static int connect_to_dbus(void)
 {
-    int ret;
-    DBusError err;
+	int ret;
+	DBusError err;
 
-    /* initialise the error value */
-    dbus_error_init(&err);
+	/* initialise the error value */
+	dbus_error_init(&err);
 
-    /* connect to the DBUS system bus, and check for errors */
-    conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
-    if (dbus_error_is_set(&err))
-    {
-	F_("Connection Error (%s)\n", err.message);
-	dbus_error_free(&err);
-    }
-    if (conn == NULL)
-    {
-	return (FALSE);
-    }
-
-
-    dbus_connection_set_watch_functions(conn, add_dbus_watch, rem_dbus_watch,
-					toggled_dbus_watch, NULL, NULL);
-
-    /* register our name on the bus, and check for errors */
-    ret = dbus_bus_request_name(conn, SOURCE_REQUEST,
-				DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
-
-    /* Make sure no error is set */
-    if (dbus_error_is_set(&err))
-    {
-	F_("Name Error (%s)\n", err.message);
-	dbus_error_free(&err);
-    }
-
-    /*  IF this is set, initng is the owner of initng.signal.source */
-    /*if ( ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { 
-       printf("Could not gain PRIMARY_OWNER of "SOURCE_REQUEST"\n");
-       return(FALSE);
-       } */
+	/* connect to the DBUS system bus, and check for errors */
+	conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
+	if (dbus_error_is_set(&err))
+	{
+		F_("Connection Error (%s)\n", err.message);
+		dbus_error_free(&err);
+	}
+	if (conn == NULL)
+	{
+		return (FALSE);
+	}
+
+
+	dbus_connection_set_watch_functions(conn, add_dbus_watch, rem_dbus_watch,
+										toggled_dbus_watch, NULL, NULL);
+
+	/* register our name on the bus, and check for errors */
+	ret = dbus_bus_request_name(conn, SOURCE_REQUEST,
+								DBUS_NAME_FLAG_REPLACE_EXISTING, &err);
+
+	/* Make sure no error is set */
+	if (dbus_error_is_set(&err))
+	{
+		F_("Name Error (%s)\n", err.message);
+		dbus_error_free(&err);
+	}
+
+	/*  IF this is set, initng is the owner of initng.signal.source */
+	/*if ( ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { 
+	   printf("Could not gain PRIMARY_OWNER of "SOURCE_REQUEST"\n");
+	   return(FALSE);
+	   } */
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
 
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", INITNG_VERSION, api_version);
-	return (FALSE);
-    }
-
-    connect_to_dbus();
-
-    /* add the hooks we are monitoring */
-    initng_plugin_hook_add(&g.SIGNAL, 50, &check_socket);
-    initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &astatus_change);
-    initng_plugin_hook_add(&g.SWATCHERS, 50, &system_state_change);
-    initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &system_pipe_watchers);
-    initng_plugin_hook_add(&g.ERR_MSG, 50, &print_error);
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", INITNG_VERSION, api_version);
+		return (FALSE);
+	}
+
+	connect_to_dbus();
+
+	/* add the hooks we are monitoring */
+	initng_plugin_hook_add(&g.SIGNAL, 50, &check_socket);
+	initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &astatus_change);
+	initng_plugin_hook_add(&g.SWATCHERS, 50, &system_state_change);
+	initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &system_pipe_watchers);
+	initng_plugin_hook_add(&g.ERR_MSG, 50, &print_error);
 
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
@@ -460,15 +460,15 @@
 
 void module_unload(void)
 {
-    if (conn != NULL)
-    {
-	dbus_connection_close(conn);
-	conn = NULL;
-    }
-
-    initng_plugin_hook_del(&g.SIGNAL, &check_socket);
-    initng_plugin_hook_del(&g.ASTATUS_CHANGE, &astatus_change);
-    initng_plugin_hook_del(&g.SWATCHERS, &system_state_change);
-    initng_plugin_hook_del(&g.PIPEWATCHERS, &system_pipe_watchers);
-    initng_plugin_hook_del(&g.ERR_MSG, &print_error);
+	if (conn != NULL)
+	{
+		dbus_connection_close(conn);
+		conn = NULL;
+	}
+
+	initng_plugin_hook_del(&g.SIGNAL, &check_socket);
+	initng_plugin_hook_del(&g.ASTATUS_CHANGE, &astatus_change);
+	initng_plugin_hook_del(&g.SWATCHERS, &system_state_change);
+	initng_plugin_hook_del(&g.PIPEWATCHERS, &system_pipe_watchers);
+	initng_plugin_hook_del(&g.ERR_MSG, &print_error);
 }

Modified: initng/trunk/plugins/debug_commands/initng_debug_commands.c
==============================================================================
--- initng/trunk/plugins/debug_commands/initng_debug_commands.c	(original)
+++ initng/trunk/plugins/debug_commands/initng_debug_commands.c	Wed Apr  5 23:11:19 2006
@@ -69,131 +69,131 @@
 s_command LIST_FDS = { 'I', "list_filedescriptors", STRING_COMMAND, ADVANCHED_COMMAND, NO_OPT, {(void *) &cmd_print_fds}, "Print all open filedescriptors initng have." };
 
 s_command QUIT_INITNG = { 'q', "quit", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND, NO_OPT,
-    {(void *) &cmd_initng_quit},
-    "Quits initng"
+	{(void *) &cmd_initng_quit},
+	"Quits initng"
 };
 
 s_command PRINT_SERVICE_DB = { 'p', "print_service_db", STRING_COMMAND, ADVANCHED_COMMAND,
-    USES_OPT,
-    {(void *) &cmd_print_service_db},
-    "Print service_db"
+	USES_OPT,
+	{(void *) &cmd_print_service_db},
+	"Print service_db"
 };
 
 s_command PRINT_ACTIVE_DB = { 'P', "print_active_db", STRING_COMMAND, ADVANCHED_COMMAND, USES_OPT,
-    {(void *) &cmd_print_active_db},
-    "Print active_db"
+	{(void *) &cmd_print_active_db},
+	"Print active_db"
 };
 
 #ifdef DEBUG
 s_command TOGGLE_VERBOSE = { 'v', "verbose", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND, NO_OPT,
-    {(void *) &cmd_toggle_verbose},
-    "Toggle the verbose flag - ONLY FOR DEBUGGING"
+	{(void *) &cmd_toggle_verbose},
+	"Toggle the verbose flag - ONLY FOR DEBUGGING"
 };
 s_command ADD_VERBOSE = { 'i', "add_verbose", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_add_verbose},
-    "Add string to watch for to make initng verbose - ONLY FOR DEBUGGING"
+	REQUIRES_OPT,
+	{(void *) &cmd_add_verbose},
+	"Add string to watch for to make initng verbose - ONLY FOR DEBUGGING"
 };
 s_command DEL_VERBOSE = { 'k', "del_verbose", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_del_verbose},
-    "Del string to watch for to make initng verbose - ONLY FOR DEBUGGING"
+	REQUIRES_OPT,
+	{(void *) &cmd_del_verbose},
+	"Del string to watch for to make initng verbose - ONLY FOR DEBUGGING"
 };
 #endif
 
 static char *cmd_print_fds(char *arg)
 {
-    char *string = NULL;
-    active_db_h *currentA;
-    s_call *currentC;
-    process_h *currentP;
-    int i;
+	char *string = NULL;
+	active_db_h *currentA;
+	s_call *currentC;
+	process_h *currentP;
+	int i;
 
-    for (i = 0; i < 1024; i++)
-    {
-
-	currentC = NULL;
-	while_list(currentC, &g.FDWATCHERS)
+	for (i = 0; i < 1024; i++)
 	{
-	    if (currentC->c.fdh->fds != i)
-		continue;
 
-	    mprintf(&string, " %i: Used by plugin: %s\n", i,
-		    currentC->from_file);
-	    break;
-	    /* Call db fs */
-	}
+		currentC = NULL;
+		while_list(currentC, &g.FDWATCHERS)
+		{
+			if (currentC->c.fdh->fds != i)
+				continue;
+
+			mprintf(&string, " %i: Used by plugin: %s\n", i,
+					currentC->from_file);
+			break;
+			/* Call db fs */
+		}
+
+		currentA = NULL;
+		while_active_db(currentA)
+		{
+			currentP = NULL;
+			while_processes(currentP, currentA)
+			{
+				if (currentP->out_pipe[0] != i)
+					continue;
+
+				mprintf(&string, " %i: Used service: %s, process: %s\n", i,
+						currentA->name, currentP->pt->name);
+				break;
+			}
+		}
 
-	currentA = NULL;
-	while_active_db(currentA)
-	{
-	    currentP = NULL;
-	    while_processes(currentP, currentA)
-	    {
-		if (currentP->out_pipe[0] != i)
-		    continue;
 
-		mprintf(&string, " %i: Used service: %s, process: %s\n", i,
-			currentA->name, currentP->pt->name);
-		break;
-	    }
+		/*mprintf(&string, " %i:\n", i); */
 	}
-
-
-	/*mprintf(&string, " %i:\n", i); */
-    }
-    return (string);
+	return (string);
 }
 
 static int cmd_initng_quit(char *arg)
 {
-    (void) arg;
-    g.when_out = THEN_QUIT;
-    initng_handler_stop_all();
-    return (TRUE);
+	(void) arg;
+	g.when_out = THEN_QUIT;
+	initng_handler_stop_all();
+	return (TRUE);
 }
 
 
 static char *cmd_print_service_db(char *arg)
 {
-    service_cache_h *s;
+	service_cache_h *s;
 
-    D_("Print service \"%s\"\n", arg);
-    if (arg && strlen(arg) > 1
-	&& (s = initng_service_cache_find_in_name(arg)))
-    {
-	return (service_db_print(s));
-    }
-    else if (arg && strlen(arg) > 1)
-    {
-	return (i_strdup("No such service.\n"));
-    }
-    else
-    {
-	return (service_db_print_all());
-    }
+	D_("Print service \"%s\"\n", arg);
+	if (arg && strlen(arg) > 1
+		&& (s = initng_service_cache_find_in_name(arg)))
+	{
+		return (service_db_print(s));
+	}
+	else if (arg && strlen(arg) > 1)
+	{
+		return (i_strdup("No such service.\n"));
+	}
+	else
+	{
+		return (service_db_print_all());
+	}
 
-    return (NULL);
+	return (NULL);
 }
 
 static char *cmd_print_active_db(char *arg)
 {
-    active_db_h *s;
+	active_db_h *s;
 
-    if (arg && strlen(arg) > 1 && (s = initng_active_db_find_in_name(arg)))
-    {
-	return (active_db_print(s));
-    }
-    else if (arg && strlen(arg) > 1)
-    {
-	return (i_strdup("No such service."));
-    }
-    else
-    {
-	return (active_db_print_all());
-    }
+	if (arg && strlen(arg) > 1 && (s = initng_active_db_find_in_name(arg)))
+	{
+		return (active_db_print(s));
+	}
+	else if (arg && strlen(arg) > 1)
+	{
+		return (i_strdup("No such service."));
+	}
+	else
+	{
+		return (active_db_print_all());
+	}
 
-    return (NULL);
+	return (NULL);
 }
 
 #ifdef DEBUG
@@ -201,93 +201,93 @@
 
 static int cmd_toggle_verbose(char *arg)
 {
-    (void) arg;
-    switch (g.verbose)
-    {
-	case 0:
-	    g.verbose = 1;
-	    break;
-	case 1:
-	    g.verbose = 0;
-	    break;
-	case 2:
-	    g.verbose = 3;
-	    break;
-	case 3:
-	    g.verbose = 2;
-	    break;
-	default:
-	    g.verbose = 0;
-	    W_("Unknown verbose id %i\n", g.verbose);
-	    break;
-    }
-    return (g.verbose);
+	(void) arg;
+	switch (g.verbose)
+	{
+		case 0:
+			g.verbose = 1;
+			break;
+		case 1:
+			g.verbose = 0;
+			break;
+		case 2:
+			g.verbose = 3;
+			break;
+		case 3:
+			g.verbose = 2;
+			break;
+		default:
+			g.verbose = 0;
+			W_("Unknown verbose id %i\n", g.verbose);
+			break;
+	}
+	return (g.verbose);
 }
 
 static int cmd_add_verbose(char *arg)
 {
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    return (initng_error_verbose_add(arg));
+	return (initng_error_verbose_add(arg));
 }
 
 static int cmd_del_verbose(char *arg)
 {
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    return (initng_error_verbose_del(arg));
+	return (initng_error_verbose_del(arg));
 }
 #endif
 
 int module_init(int api_version)
 {
-    D_("module_init(stcmd);\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_command_add(&LIST_FDS);
-    if (!g.i_am_init)
-    {
-	initng_command_add(&QUIT_INITNG);
-    }
-    initng_command_add(&PRINT_SERVICE_DB);
-    initng_command_add(&PRINT_ACTIVE_DB);
+	D_("module_init(stcmd);\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_command_add(&LIST_FDS);
+	if (!g.i_am_init)
+	{
+		initng_command_add(&QUIT_INITNG);
+	}
+	initng_command_add(&PRINT_SERVICE_DB);
+	initng_command_add(&PRINT_ACTIVE_DB);
 
 #ifdef DEBUG
-    initng_command_add(&TOGGLE_VERBOSE);
-    initng_command_add(&ADD_VERBOSE);
-    initng_command_add(&DEL_VERBOSE);
+	initng_command_add(&TOGGLE_VERBOSE);
+	initng_command_add(&ADD_VERBOSE);
+	initng_command_add(&DEL_VERBOSE);
 #endif
 
 
-    D_("libstcmd.so.0.0 loaded!\n");
-    return (TRUE);
+	D_("libstcmd.so.0.0 loaded!\n");
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    D_("module_unload(stcmd);\n");
+	D_("module_unload(stcmd);\n");
 
-    initng_command_del(&LIST_FDS);
-    if (!g.i_am_init)
-    {
-	initng_command_del(&QUIT_INITNG);
-    }
-    initng_command_del(&PRINT_SERVICE_DB);
-    initng_command_del(&PRINT_ACTIVE_DB);
+	initng_command_del(&LIST_FDS);
+	if (!g.i_am_init)
+	{
+		initng_command_del(&QUIT_INITNG);
+	}
+	initng_command_del(&PRINT_SERVICE_DB);
+	initng_command_del(&PRINT_ACTIVE_DB);
 #ifdef DEBUG
-    initng_command_del(&TOGGLE_VERBOSE);
-    initng_command_del(&ADD_VERBOSE);
-    initng_command_del(&DEL_VERBOSE);
+	initng_command_del(&TOGGLE_VERBOSE);
+	initng_command_del(&ADD_VERBOSE);
+	initng_command_del(&DEL_VERBOSE);
 #endif
 
 
-    D_("libstcmd.so.0.0 unloaded!\n");
+	D_("libstcmd.so.0.0 unloaded!\n");
 
 }

Modified: initng/trunk/plugins/debug_commands/print_service.c
==============================================================================
--- initng/trunk/plugins/debug_commands/print_service.c	(original)
+++ initng/trunk/plugins/debug_commands/print_service.c	Wed Apr  5 23:11:19 2006
@@ -48,90 +48,90 @@
 /* some stdout */
 char *service_db_print(service_cache_h * s)
 {
-    char *string = NULL;
+	char *string = NULL;
 
-    service_db_print_u(s, &string);
-    return (string);
+	service_db_print_u(s, &string);
+	return (string);
 }
 
 char *active_db_print(active_db_h * s)
 {
-    char *string = NULL;
+	char *string = NULL;
 
-    active_db_print_u(s, &string);
-    return (string);
+	active_db_print_u(s, &string);
+	return (string);
 }
 
 /* there may be unprintable characters in string - should escape them when printing */
 static void print_string_value(char *string, char **to)
 {
-    int i;
+	int i;
 
-    for (i = 0; string[i] != 0; i++)
-    {
-	if (IS_PRINTABLE(string[i]))
-	    mprintf(to, "%c", string[i]);
-	else
-	    mprintf(to, "^%c", string[i] ^ 0x40);
-    }
+	for (i = 0; string[i] != 0; i++)
+	{
+		if (IS_PRINTABLE(string[i]))
+			mprintf(to, "%c", string[i]);
+		else
+			mprintf(to, "^%c", string[i] ^ 0x40);
+	}
 }
 
 static void print_sdata(s_data * tmp, char **string)
 {
-    if (!tmp->type)
-	return;
-    switch (tmp->type->opt_type)
-    {
-	case STRING:
-	case STRINGS:
-	    if (!tmp->t.s)
-	    {
-		F_("empty value!\n");
-		return;
-	    }
-	    mprintf(string, " @@ %-24s : \"", tmp->type->opt_name);
-
-	    print_string_value(tmp->t.s, string);
-	    mprintf(string, "\"\n");
-	    return;
-	case VARIABLE_STRING:
-	case VARIABLE_STRINGS:
-	    if (!tmp->t.s)
-	    {
-		F_("empty value!\n");
+	if (!tmp->type)
 		return;
-	    }
-	    if (tmp->vn)
-		mprintf(string, " @@ %-13s %-10s : \"", tmp->type->opt_name,
-			tmp->vn);
-	    else
-		mprintf(string, " @@ %-13s %-10s : \"", tmp->type->opt_name,
-			tmp->vn);
-
-	    print_string_value(tmp->t.s, string);
-	    mprintf(string, "\"\n");
-	    return;
-	case INT:
-	    mprintf(string, " @@ %-24s : \"%i\"\n", tmp->type->opt_name,
-		    tmp->t.i);
-	    return;
-	case VARIABLE_INT:
-	    mprintf(string, " @@ %-13s %-10s : \"%i\"\n", tmp->type->opt_name,
-		    tmp->vn, tmp->t.i);
-	    return;
-	case SET:
-	    mprintf(string, " @@ %-24s\n", tmp->type->opt_name);
-	    return;
-	case VARIABLE_SET:
-	    mprintf(string, " @@ %-13s %-10s\n", tmp->type->opt_name,
-		    tmp->vn);
-	    return;
-	case ALIAS:
-	    mprintf(string, " @@ ALIAS %-24s\n", tmp->type->opt_name);
-	    return;
-	default:
-	    return;
-    }
+	switch (tmp->type->opt_type)
+	{
+		case STRING:
+		case STRINGS:
+			if (!tmp->t.s)
+			{
+				F_("empty value!\n");
+				return;
+			}
+			mprintf(string, " @@ %-24s : \"", tmp->type->opt_name);
+
+			print_string_value(tmp->t.s, string);
+			mprintf(string, "\"\n");
+			return;
+		case VARIABLE_STRING:
+		case VARIABLE_STRINGS:
+			if (!tmp->t.s)
+			{
+				F_("empty value!\n");
+				return;
+			}
+			if (tmp->vn)
+				mprintf(string, " @@ %-13s %-10s : \"", tmp->type->opt_name,
+						tmp->vn);
+			else
+				mprintf(string, " @@ %-13s %-10s : \"", tmp->type->opt_name,
+						tmp->vn);
+
+			print_string_value(tmp->t.s, string);
+			mprintf(string, "\"\n");
+			return;
+		case INT:
+			mprintf(string, " @@ %-24s : \"%i\"\n", tmp->type->opt_name,
+					tmp->t.i);
+			return;
+		case VARIABLE_INT:
+			mprintf(string, " @@ %-13s %-10s : \"%i\"\n", tmp->type->opt_name,
+					tmp->vn, tmp->t.i);
+			return;
+		case SET:
+			mprintf(string, " @@ %-24s\n", tmp->type->opt_name);
+			return;
+		case VARIABLE_SET:
+			mprintf(string, " @@ %-13s %-10s\n", tmp->type->opt_name,
+					tmp->vn);
+			return;
+		case ALIAS:
+			mprintf(string, " @@ ALIAS %-24s\n", tmp->type->opt_name);
+			return;
+		default:
+			return;
+	}
 
 }
 
@@ -139,72 +139,72 @@
 
 static void service_db_print_u(service_cache_h * s, char **string)
 {
-    /*data path */
-    s_data *tmp = NULL;
+	/*data path */
+	s_data *tmp = NULL;
 
-    assert(s);
-    assert(s->name);
+	assert(s);
+	assert(s->name);
 
-    /* if string is emty print header */
-    if (!(*string))
-    {
-	mprintf(string, "\n#  %s  \"%s", s->type->name, s->name);
-	if (s->father_name)
-	    mprintf(string, " : %s", s->father_name);
-	mprintf(string, "\"\n");
-    }
+	/* if string is emty print header */
+	if (!(*string))
+	{
+		mprintf(string, "\n#  %s  \"%s", s->type->name, s->name);
+		if (s->father_name)
+			mprintf(string, " : %s", s->father_name);
+		mprintf(string, "\"\n");
+	}
+
+	mprintf(string, "    ---------------------------------- \n");
 
-    mprintf(string, "    ---------------------------------- \n");
+	list_for_each_entry(tmp, &s->data.head.list, list)
+	{
+		print_sdata(tmp, string);
+	}
 
-    list_for_each_entry(tmp, &s->data.head.list, list)
-    {
-	print_sdata(tmp, string);
-    }
-
-    /* if father with data exits, print it */
-    if (s->father)
-    {
-	D_("FATHER FOUND %s\n", s->name);
-	service_db_print_u(s->father, string);
-    }
-    else
-	D_("FATHER NOT FOUND %s\n", s->name);
+	/* if father with data exits, print it */
+	if (s->father)
+	{
+		D_("FATHER FOUND %s\n", s->name);
+		service_db_print_u(s->father, string);
+	}
+	else
+		D_("FATHER NOT FOUND %s\n", s->name);
 }
 
 
 /* Walk through every service and print it all */
 char *service_db_print_all(void)
 {
-    char *string = NULL;
-    service_cache_h *current = NULL;
+	char *string = NULL;
+	service_cache_h *current = NULL;
 
-    mprintf(&string, "Full service print:\n");
+	mprintf(&string, "Full service print:\n");
 
-    D_("print_all():\n");
+	D_("print_all():\n");
 
-    while_service_cache(current)
-    {
-	D_("printing %s ...\n", current->name);
-	service_db_print_u(current, &string);
-    }
+	while_service_cache(current)
+	{
+		D_("printing %s ...\n", current->name);
+		service_db_print_u(current, &string);
+	}
 
-    return (string);
+	return (string);
 }
 
 static void active_db_print_process(process_h * p, char **string)
 {
-    assert(p);
-    mprintf(string, "\tProcess: type %s\n", p->pt->name);
-    mprintf(string, "\t\tPid: %i\n", p->pid);
-    mprintf(string, "\t\tR_code: %i\n", p->r_code);
-    mprintf(string, "\t\tFds read: %i, write: %i\n", p->out_pipe[0],
-	    p->out_pipe[1]);
-    mprintf(string, "\t\tpst: %i\n", p->pst);
-    if (p->buffer)
-    {
-	mprintf(string, "\t\tBuffer (%i): \"%s\"\n", p->buffer_allocated,
-		p->buffer);
-    }
+	assert(p);
+	mprintf(string, "\tProcess: type %s\n", p->pt->name);
+	mprintf(string, "\t\tPid: %i\n", p->pid);
+	mprintf(string, "\t\tR_code: %i\n", p->r_code);
+	mprintf(string, "\t\tFds read: %i, write: %i\n", p->out_pipe[0],
+			p->out_pipe[1]);
+	mprintf(string, "\t\tpst: %i\n", p->pst);
+	if (p->buffer)
+	{
+		mprintf(string, "\t\tBuffer (%i): \"%s\"\n", p->buffer_allocated,
+				p->buffer);
+	}
 
 }
 
@@ -212,77 +212,77 @@
 
 static void active_db_print_u(active_db_h * s, char **string)
 {
-    /*data path */
-    s_data *tmp = NULL;
-    process_h *process = NULL;
+	/*data path */
+	s_data *tmp = NULL;
+	process_h *process = NULL;
 
-    assert(s);
-    assert(s->name);
+	assert(s);
+	assert(s->name);
 
 
-    struct timeval now;
+	struct timeval now;
 
-    mprintf(string, "\n#  %s  \"%s", s->type->name, s->name);
-    if (s->from_service && s->from_service->father_name)
-	mprintf(string, " : %s", s->from_service->father_name);
-    mprintf(string, "\"\n");
+	mprintf(string, "\n#  %s  \"%s", s->type->name, s->name);
+	if (s->from_service && s->from_service->father_name)
+		mprintf(string, " : %s", s->from_service->father_name);
+	mprintf(string, "\"\n");
 
-    if (s->current_state && s->current_state->state_name)
-    {
-	mprintf(string, "\tactive status: %s\n",
-		s->current_state->state_name);
-    }
+	if (s->current_state && s->current_state->state_name)
+	{
+		mprintf(string, "\tactive status: %s\n",
+				s->current_state->state_name);
+	}
 
-    gettimeofday(&now, NULL);
+	gettimeofday(&now, NULL);
 
-    mprintf(string,
-	    "\tlast_rought_time: %ims time_last_state: %ims time_current_state: %ims\n",
-	    MS_DIFF(now, s->last_rought_time), MS_DIFF(now,
-						       s->
-						       time_last_state),
-	    MS_DIFF(now, s->time_current_state));
+	mprintf(string,
+			"\tlast_rought_time: %ims time_last_state: %ims time_current_state: %ims\n",
+			MS_DIFF(now, s->last_rought_time), MS_DIFF(now,
+													   s->
+													   time_last_state),
+			MS_DIFF(now, s->time_current_state));
 
-    /* print processes if any */
+	/* print processes if any */
 
-    while_processes(process, s)
-    {
-	active_db_print_process(process, string);
-    }
+	while_processes(process, s)
+	{
+		active_db_print_process(process, string);
+	}
 
 
 
 
 
 
-    mprintf(string, "\tactive_db opts:\n");
+	mprintf(string, "\tactive_db opts:\n");
 
-    list_for_each_entry(tmp, &(s->data.head.list), list)
-    {
-    }
+	list_for_each_entry(tmp, &(s->data.head.list), list)
+	{
+	}
 
-    if (s->from_service)
-    {
-	mprintf(string, "\tservice_db opts:\n");
-	tmp = NULL;
-	list_for_each_entry(tmp, &(s->from_service->data.head.list), list)
+	if (s->from_service)
 	{
-	    print_sdata(tmp, string);
+		mprintf(string, "\tservice_db opts:\n");
+		tmp = NULL;
+		list_for_each_entry(tmp, &(s->from_service->data.head.list), list)
+		{
+			print_sdata(tmp, string);
+		}
 	}
-    }
 }
 
 /* Walk through every service and print it all */
 char *active_db_print_all(void)
 {
-    char *string = NULL;
-    active_db_h *apt = NULL;
+	char *string = NULL;
+	active_db_h *apt = NULL;
 
-    D_("print_all():\n");
+	D_("print_all():\n");
 
-    while_active_db(apt)
-    {
-	active_db_print_u(apt, &string);
-    }
+	while_active_db(apt)
+	{
+		active_db_print_u(apt, &string);
+	}
 
-    return (string);
+	return (string);
 }

Modified: initng/trunk/plugins/envparser/initng_envparser.c
==============================================================================
--- initng/trunk/plugins/envparser/initng_envparser.c	(original)
+++ initng/trunk/plugins/envparser/initng_envparser.c	Wed Apr  5 23:11:19 2006
@@ -36,10 +36,10 @@
 #include <initng_env_variable.h>
 
 s_entry ENV_FILE = { "env_file", STRINGS, NULL,
-    "Parse this file for environmental variables."
+	"Parse this file for environmental variables."
 };
 s_entry ENV_FILE_REQUIRED = { "env_file_required", STRINGS, NULL,
-    "Same as env_file, but service will fail if the file doesn't exist."
+	"Same as env_file, but service will fail if the file doesn't exist."
 };
 
 static int parse_file(const char *file, service_cache_h * s);
@@ -47,181 +47,181 @@
 /* Parse all the env_file's when service finished loading */
 static int env_parser(service_cache_h * s)
 {
-    const char *file = NULL;
-    s_data *itt = NULL;
+	const char *file = NULL;
+	s_data *itt = NULL;
 
-    assert(s);
+	assert(s);
 
-    /* make sure the env_file is set */
-    if (!is(&ENV_FILE, s))
-	return (TRUE);
+	/* make sure the env_file is set */
+	if (!is(&ENV_FILE, s))
+		return (TRUE);
+
+	/* TODO, put this into one while loop */
 
-    /* TODO, put this into one while loop */
+	/* Parse all ENV_FILE's */
+	while ((file = get_next_string(&ENV_FILE, s, &itt)))
+	{
+		parse_file(file, s);
+	}
+	itt = NULL;
 
-    /* Parse all ENV_FILE's */
-    while ((file = get_next_string(&ENV_FILE, s, &itt)))
-    {
-	parse_file(file, s);
-    }
-    itt = NULL;
-
-    /* Parse all, and stop if files don't exits, or not parseable */
-    while ((file = get_next_string(&ENV_FILE_REQUIRED, s, &itt)))
-    {
-	if (parse_file(file, s) == FALSE)
-	    return (FALSE);
-    }
+	/* Parse all, and stop if files don't exits, or not parseable */
+	while ((file = get_next_string(&ENV_FILE_REQUIRED, s, &itt)))
+	{
+		if (parse_file(file, s) == FALSE)
+			return (FALSE);
+	}
 
-    return (TRUE);
+	return (TRUE);
 }
 
 static int parse_file(const char *file, service_cache_h * s)
 {
 
-    char *file_content = NULL;
-    char *point = NULL;
+	char *file_content = NULL;
+	char *point = NULL;
 
-    /* open that file */
-    if (!open_read_close(file, &file_content))
-	return (FALSE);
-
-
-    /* Start Parsing */
-    point = file_content;
-    while (point[0])
-    {
-	char *vn = NULL;	/* env variable name  */
-	char *vv = NULL;	/* env variable value */
-
-	int i = 0;
-	int quoted = FALSE;
-
-	/* skip initial spaces */
-	JUMP_SPACES(point);
-	if (!point[0])
-	    break;
+	/* open that file */
+	if (!open_read_close(file, &file_content))
+		return (FALSE);
 
-	/* skip rows, starting with '#' */
-	if (point[0] == '#')
-	{
-	    JUMP_TO_NEXT_ROW(point);
-	    continue;
-	}
 
-	/* make sure the line contains (and doesn't begin with) a '=', if not, its not an ENV line */
-	i = 0;
-	while (point[i] && point[i] != '=' && point[i] != '\n')
-	    i++;
-	if (point[i] != '=' || i == 0)
+	/* Start Parsing */
+	point = file_content;
+	while (point[0])
 	{
-	    JUMP_TO_NEXT_ROW(point);
-	    continue;
-	}
+		char *vn = NULL;		/* env variable name  */
+		char *vv = NULL;		/* env variable value */
 
-	/* skip ending spaces and '=' char */
-	while (point[i - 1] == ' ' || point[i - 1] == '\t')
-	    i--;
-
-	/* copy that vn */
-	vn = i_strndup(point, i);
-
-	point += i;
-
-	/* jump any spaces and '=' char */
-	JUMP_SPACES(point);
-	if (point[0] == '=')
-	    point++;
-	JUMP_SPACES(point);
+		int i = 0;
+		int quoted = FALSE;
 
-	i = 0;
-	while (point[i] && (quoted != FALSE || point[i] != '\n'))
-	{
-	    if (point[i] == '"' || point[i] == '\'')
-	    {
+		/* skip initial spaces */
+		JUMP_SPACES(point);
+		if (!point[0])
+			break;
 
-		if (quoted == FALSE)
-		    quoted = point[i];
-		else if (quoted == point[i])
-		    quoted = FALSE;
-
-		if (i == 0)
+		/* skip rows, starting with '#' */
+		if (point[0] == '#')
 		{
-		    point++;
-		    continue;
+			JUMP_TO_NEXT_ROW(point);
+			continue;
 		}
 
-		if (vv)
+		/* make sure the line contains (and doesn't begin with) a '=', if not, its not an ENV line */
+		i = 0;
+		while (point[i] && point[i] != '=' && point[i] != '\n')
+			i++;
+		if (point[i] != '=' || i == 0)
 		{
-		    vv = i_realloc(vv, sizeof(char) * (strlen(vv) + i + 1));
-		    strncat(vv, point, i);
+			JUMP_TO_NEXT_ROW(point);
+			continue;
 		}
-		else
-		    vv = i_strndup(point, i);
 
-		point += (i + 1);
+		/* skip ending spaces and '=' char */
+		while (point[i - 1] == ' ' || point[i - 1] == '\t')
+			i--;
+
+		/* copy that vn */
+		vn = i_strndup(point, i);
+
+		point += i;
+
+		/* jump any spaces and '=' char */
+		JUMP_SPACES(point);
+		if (point[0] == '=')
+			point++;
+		JUMP_SPACES(point);
+
 		i = 0;
-	    }
-	    else
-		i++;
-	}
+		while (point[i] && (quoted != FALSE || point[i] != '\n'))
+		{
+			if (point[i] == '"' || point[i] == '\'')
+			{
 
-	/* copy the variable value */
-	if (vv && i > 0)
-	{
-	    vv = i_realloc(vv, sizeof(char) * (strlen(vv) + i));
-	    strncat(vv, point, i);
-	}
-	else if (i > 0)
-	    vv = i_strndup(point, i);
-	else if (!vv)
-	{
-	    /* empty value. make sure vv contains at least '\0' */
-	    vv = i_calloc(1, sizeof(char));
-	    vv[0] = '\0';
-	}
+				if (quoted == FALSE)
+					quoted = point[i];
+				else if (quoted == point[i])
+					quoted = FALSE;
+
+				if (i == 0)
+				{
+					point++;
+					continue;
+				}
+
+				if (vv)
+				{
+					vv = i_realloc(vv, sizeof(char) * (strlen(vv) + i + 1));
+					strncat(vv, point, i);
+				}
+				else
+					vv = i_strndup(point, i);
+
+				point += (i + 1);
+				i = 0;
+			}
+			else
+				i++;
+		}
 
-	point += i;
+		/* copy the variable value */
+		if (vv && i > 0)
+		{
+			vv = i_realloc(vv, sizeof(char) * (strlen(vv) + i));
+			strncat(vv, point, i);
+		}
+		else if (i > 0)
+			vv = i_strndup(point, i);
+		else if (!vv)
+		{
+			/* empty value. make sure vv contains at least '\0' */
+			vv = i_calloc(1, sizeof(char));
+			vv[0] = '\0';
+		}
 
-	/* add to service cache */
-	if (is_var(&ENV, vn, s))
-	{
-	    const char *oldval = get_string_var(&ENV, vn,
-						s);
-	    char *fixed = fix_redefined_variable(vn, oldval, vv);
+		point += i;
 
-	    free(vv);
-	    set_string_var(&ENV, vn, s, fixed);
-	}
-	else
-	{
-	    set_string_var(&ENV, vn, s, vv);
-	}
+		/* add to service cache */
+		if (is_var(&ENV, vn, s))
+		{
+			const char *oldval = get_string_var(&ENV, vn,
+												s);
+			char *fixed = fix_redefined_variable(vn, oldval, vv);
 
-	/* go to next row and parse */
-	JUMP_TO_NEXT_ROW(point);
-    }
-    free(file_content);
-    return (TRUE);
+			free(vv);
+			set_string_var(&ENV, vn, s, fixed);
+		}
+		else
+		{
+			set_string_var(&ENV, vn, s, vv);
+		}
+
+		/* go to next row and parse */
+		JUMP_TO_NEXT_ROW(point);
+	}
+	free(file_content);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-    D_("module_init();\n");
-
-    initng_service_data_types_add(&ENV_FILE);
-    initng_service_data_types_add(&ENV_FILE_REQUIRED);
-    return (initng_plugin_hook_add(&g.ADDITIONAL_PARSE, 80, &env_parser));
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+	D_("module_init();\n");
+
+	initng_service_data_types_add(&ENV_FILE);
+	initng_service_data_types_add(&ENV_FILE_REQUIRED);
+	return (initng_plugin_hook_add(&g.ADDITIONAL_PARSE, 80, &env_parser));
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&ENV_FILE);
-    initng_service_data_types_del(&ENV_FILE_REQUIRED);
-    initng_plugin_hook_del(&g.ADDITIONAL_PARSE, &env_parser);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&ENV_FILE);
+	initng_service_data_types_del(&ENV_FILE_REQUIRED);
+	initng_plugin_hook_del(&g.ADDITIONAL_PARSE, &env_parser);
 }

Modified: initng/trunk/plugins/find/initng_find.c
==============================================================================
--- initng/trunk/plugins/find/initng_find.c	(original)
+++ initng/trunk/plugins/find/initng_find.c	Wed Apr  5 23:11:19 2006
@@ -44,204 +44,204 @@
 
 static service_cache_h *search_dir(const char *for_service, const char *dir)
 {
-    service_cache_h *tmp = NULL;
-    DIR *path;
-    struct dirent *dir_e;
-    struct stat fstat;
-    char file[101];
-
-    /*printf("search_dir: %s for %s\n", dir, for_service); */
-
-    path = opendir(dir);
-    if (!path)
-	return (NULL);
-
-    /* Walk thru all files in dir */
-    while ((dir_e = readdir(path)))
-    {
-	/* skip dirs/files starting with a . */
-	if (dir_e->d_name[0] == '.')
-	    continue;
-
-
-	/* set up full path */
-	strncpy(file, dir, 40);
-	strcat(file, "/");
-	strcat(file, dir_e->d_name);
+	service_cache_h *tmp = NULL;
+	DIR *path;
+	struct dirent *dir_e;
+	struct stat fstat;
+	char file[101];
 
+	/*printf("search_dir: %s for %s\n", dir, for_service); */
 
+	path = opendir(dir);
+	if (!path)
+		return (NULL);
 
-	/* get the stat of that file */
-	if (stat(file, &fstat) != 0)
+	/* Walk thru all files in dir */
+	while ((dir_e = readdir(path)))
 	{
-	    printf("File %s failed stat errno: %s\n", file, strerror(errno));
-	    continue;
-	}
+		/* skip dirs/files starting with a . */
+		if (dir_e->d_name[0] == '.')
+			continue;
 
-	/* if it is a dir */
-	if (S_ISDIR(fstat.st_mode))
-	{
-	    /* Cal ur self function with that dir */
-	    tmp = search_dir(for_service, file);
-	    if (tmp)
-		return (tmp);
 
-	    /* continue while loop */
-	    continue;
-	}
+		/* set up full path */
+		strncpy(file, dir, 40);
+		strcat(file, "/");
+		strcat(file, dir_e->d_name);
 
-	/* if it is a file */
-	if (S_ISREG(fstat.st_mode))
-	{
-	    /* check if it contains the keyword we are looking for */
-	    if (!strstr(file, for_service))
-		continue;
 
-	    {
-		/* cut the initiating "/etc/initng/" */
-		char *s = file + ((strlen(INITNG_ROOT) + 1) * sizeof(char));
 
-		/* cut the ending ".i" */
-		int i = 0;
+		/* get the stat of that file */
+		if (stat(file, &fstat) != 0)
+		{
+			printf("File %s failed stat errno: %s\n", file, strerror(errno));
+			continue;
+		}
+
+		/* if it is a dir */
+		if (S_ISDIR(fstat.st_mode))
+		{
+			/* Cal ur self function with that dir */
+			tmp = search_dir(for_service, file);
+			if (tmp)
+				return (tmp);
 
-		while (s[i] && s[i] != '.')
-		    i++;
-		s[i] = '\0';
+			/* continue while loop */
+			continue;
+		}
 
-		W_("Service should be \"%s\"\n", s, for_service);
-		if ((tmp = initng_common_parse_service(s)))
+		/* if it is a file */
+		if (S_ISREG(fstat.st_mode))
 		{
-		    closedir(path);
-		    return (tmp);
+			/* check if it contains the keyword we are looking for */
+			if (!strstr(file, for_service))
+				continue;
+
+			{
+				/* cut the initiating "/etc/initng/" */
+				char *s = file + ((strlen(INITNG_ROOT) + 1) * sizeof(char));
+
+				/* cut the ending ".i" */
+				int i = 0;
+
+				while (s[i] && s[i] != '.')
+					i++;
+				s[i] = '\0';
+
+				W_("Service should be \"%s\"\n", s, for_service);
+				if ((tmp = initng_common_parse_service(s)))
+				{
+					closedir(path);
+					return (tmp);
+				}
+			}
 		}
-	    }
 	}
-    }
-    closedir(path);
-    return (NULL);
+	closedir(path);
+	return (NULL);
 }
 
 /* Load a service from a process_name or process_path */
 static service_cache_h *initng_find(const char *service)
 {
-    /* means that it may not be a direct service request, then we start looking in subfolders */
-
-    service_cache_h *tmp = NULL;
+	/* means that it may not be a direct service request, then we start looking in subfolders */
 
-    assert(service);
+	service_cache_h *tmp = NULL;
 
-    /* Try get by alias file */
-    {
-	char *alias_name = NULL;
+	assert(service);
 
-	/* try get from alias file */
-	if ((alias_name = get_find_alias(service)))
+	/* Try get by alias file */
 	{
-	    /* also try to find a service with that name */
-	    tmp = initng_common_parse_service(alias_name);
-	    free(alias_name);
+		char *alias_name = NULL;
 
-	    if (tmp)
-		return (tmp);
+		/* try get from alias file */
+		if ((alias_name = get_find_alias(service)))
+		{
+			/* also try to find a service with that name */
+			tmp = initng_common_parse_service(alias_name);
+			free(alias_name);
+
+			if (tmp)
+				return (tmp);
+		}
 	}
-    }
 
-    /* Never try to find a service with a '/' in the name, it already have a path */
-    if (strstr(service, "/"))
-    {
-	printf("This is a full path, nothing to search on.\n");
-	return (NULL);
-    }
+	/* Never try to find a service with a '/' in the name, it already have a path */
+	if (strstr(service, "/"))
+	{
+		printf("This is a full path, nothing to search on.\n");
+		return (NULL);
+	}
 
-    /* browser initng root, in searching for a file matching service name */
-    if ((tmp = search_dir(service, INITNG_ROOT)))
-	return (tmp);
+	/* browser initng root, in searching for a file matching service name */
+	if ((tmp = search_dir(service, INITNG_ROOT)))
+		return (tmp);
 
-    return (NULL);
+	return (NULL);
 }
 
 #define ALIAS_FILE  INITNG_PLUGIN_DIR "/service_alias"
 static char *get_find_alias(const char *from)
 {
-    int from_len = 0;
-    int i = 0;
-
-    char *file_content = NULL;
-    char *point = NULL;
-    char *point_result = NULL;
-    char *ret = NULL;
-
-    D_("Finding alias for %s\n", from);
-    /* open that file */
-    if (!open_read_close(ALIAS_FILE, &file_content))
-	return (NULL);
+	int from_len = 0;
+	int i = 0;
 
-    /* get length of what we are searching */
-    from_len = strlen(from);
+	char *file_content = NULL;
+	char *point = NULL;
+	char *point_result = NULL;
+	char *ret = NULL;
+
+	D_("Finding alias for %s\n", from);
+	/* open that file */
+	if (!open_read_close(ALIAS_FILE, &file_content))
+		return (NULL);
+
+	/* get length of what we are searching */
+	from_len = strlen(from);
+
+	/* Start Parsing */
+	point = file_content;
+	while (point[0])
+	{
+		/* skip initial spaces */
+		JUMP_SPACES(point);
+		if (!point[0])
+			break;
 
-    /* Start Parsing */
-    point = file_content;
-    while (point[0])
-    {
-	/* skip initial spaces */
-	JUMP_SPACES(point);
-	if (!point[0])
-	    break;
-
-	/* skip rows, starting with '#' */
-	if (point[0] == '#')
-	{
-	    JUMP_TO_NEXT_ROW(point);
-	    continue;
-	}
+		/* skip rows, starting with '#' */
+		if (point[0] == '#')
+		{
+			JUMP_TO_NEXT_ROW(point);
+			continue;
+		}
 
-	/* check if first word is a match */
-	if (strncasecmp(point, from, from_len) != 0)
-	{
-	    JUMP_TO_NEXT_ROW(point);
-	    continue;
-	}
+		/* check if first word is a match */
+		if (strncasecmp(point, from, from_len) != 0)
+		{
+			JUMP_TO_NEXT_ROW(point);
+			continue;
+		}
 
-	if (!point[from_len] || !point[from_len + 1]
-	    || point[from_len] != '=')
-	{
-	    JUMP_TO_NEXT_ROW(point);
-	    continue;
-	}
+		if (!point[from_len] || !point[from_len + 1]
+			|| point[from_len] != '=')
+		{
+			JUMP_TO_NEXT_ROW(point);
+			continue;
+		}
 
-	/* Put pointer to result after the '=' */
-	point_result = point + from_len + 1;
+		/* Put pointer to result after the '=' */
+		point_result = point + from_len + 1;
 
-	while (point_result[i] && point_result[i] != '\n')
-	    i++;
+		while (point_result[i] && point_result[i] != '\n')
+			i++;
 
-	/* copy the rest of line */
-	ret = i_strndup(point_result, i);
+		/* copy the rest of line */
+		ret = i_strndup(point_result, i);
 
+		free(file_content);
+		return (ret);
+	}
 	free(file_content);
-	return (ret);
-    }
-    free(file_content);
-    return (NULL);
+	return (NULL);
 }
 
 
 int module_init(int api_version)
 {
 
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    return (initng_plugin_hook_add(&g.PARSERS, 70, &initng_find));
+	return (initng_plugin_hook_add(&g.PARSERS, 70, &initng_find));
 
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_plugin_hook_del(&g.PARSERS, &initng_find);
+	D_("module_unload();\n");
+	initng_plugin_hook_del(&g.PARSERS, &initng_find);
 }

Modified: initng/trunk/plugins/fstat/initng_fstat.c
==============================================================================
--- initng/trunk/plugins/fstat/initng_fstat.c	(original)
+++ initng/trunk/plugins/fstat/initng_fstat.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -35,19 +35,19 @@
 #include <initng_static_states.h>
 
 s_entry WAIT_FOR_FILE = { "wait_for_file", STRINGS, NULL,
-    "Check so that this files exits before launching."
+	"Check so that this files exits before launching."
 };
 
 s_entry REQUIRE_FILE = { "require_file", STRINGS, NULL,
-    "If this file dont exist, this service will FAIL directly."
+	"If this file dont exist, this service will FAIL directly."
 };
 
 s_entry WAIT_FOR_FILE_AFTER = { "wait_for_file_after", STRINGS, NULL,
-    "Make sure this files exits before a service can be marked as up."
+	"Make sure this files exits before a service can be marked as up."
 };
 
 s_entry REQUIRE_FILE_AFTER = { "require_file_after", STRINGS, NULL,
-    "If this file dont exist after, the service will be marked FAIL."
+	"If this file dont exist after, the service will be marked FAIL."
 };
 
 a_state_h REQUIRE_FILE_FAILED = { "REQUIRE_FILE_FAILED", IS_FAILED, NULL, NULL, NULL };
@@ -60,37 +60,37 @@
  */
 static int check_files_to_exist(active_db_h * service)
 {
-    const char *file = NULL;
-    s_data *itt = NULL;
-    struct stat file_stat;
-
-    /* CHECK WAIT_FOR_FILE */
-    while ((file = get_next_string(&WAIT_FOR_FILE, service, &itt)))
-    {
-	D_("Service %s need file %s to exist\n", service->name, file);
-	if (stat(file, &file_stat) != 0)
-	{
-	    D_("File %s needed by %s doesn't exist.\n", file, service->name);
-	    /* set the alarm, make sure initng will search files, in one second */
-	    initng_global_set_sleep(1);
+	const char *file = NULL;
+	s_data *itt = NULL;
+	struct stat file_stat;
 
-	    /* don't change status of service to START_DEP_MET */
-	    return (FALSE);
+	/* CHECK WAIT_FOR_FILE */
+	while ((file = get_next_string(&WAIT_FOR_FILE, service, &itt)))
+	{
+		D_("Service %s need file %s to exist\n", service->name, file);
+		if (stat(file, &file_stat) != 0)
+		{
+			D_("File %s needed by %s doesn't exist.\n", file, service->name);
+			/* set the alarm, make sure initng will search files, in one second */
+			initng_global_set_sleep(1);
+
+			/* don't change status of service to START_DEP_MET */
+			return (FALSE);
+		}
 	}
-    }
 
-    /* CHECK REQUIRE_FILE */
-    while ((file = get_next_string(&REQUIRE_FILE, service, &itt)))
-    {
-	D_("Service %s need file %s to exist\n", service->name, file);
-	if (stat(file, &file_stat) != 0)
+	/* CHECK REQUIRE_FILE */
+	while ((file = get_next_string(&REQUIRE_FILE, service, &itt)))
 	{
-	    initng_common_mark_service(service, &REQUIRE_FILE_FAILED);
-	    return (FALSE);
+		D_("Service %s need file %s to exist\n", service->name, file);
+		if (stat(file, &file_stat) != 0)
+		{
+			initng_common_mark_service(service, &REQUIRE_FILE_FAILED);
+			return (FALSE);
+		}
 	}
-    }
 
-    return (TRUE);
+	return (TRUE);
 }
 
 /*
@@ -98,73 +98,73 @@
  */
 static int check_files_to_exist_after(active_db_h * service)
 {
-    const char *file = NULL;
-    s_data *itt = NULL;
+	const char *file = NULL;
+	s_data *itt = NULL;
 
-    struct stat file_stat;
+	struct stat file_stat;
 
-    /* check WAIT_FOR_FILE_AFTER */
-    while ((file = get_next_string(&WAIT_FOR_FILE_AFTER, service, &itt)))
-    {
-	D_("Service %s need file %s before it can be set to RUNNING\n",
-	   service->name, file);
-	if (stat(file, &file_stat) != 0)
+	/* check WAIT_FOR_FILE_AFTER */
+	while ((file = get_next_string(&WAIT_FOR_FILE_AFTER, service, &itt)))
 	{
-	    D_("File %s needed by %s doesn't exist.\n", file, service->name);
-	    /* set the alarm, make sure initng will search files, in one second */
-	    initng_global_set_sleep(1);
-
-	    /* don't change status of service to START_READY */
-	    return (FALSE);
+		D_("Service %s need file %s before it can be set to RUNNING\n",
+		   service->name, file);
+		if (stat(file, &file_stat) != 0)
+		{
+			D_("File %s needed by %s doesn't exist.\n", file, service->name);
+			/* set the alarm, make sure initng will search files, in one second */
+			initng_global_set_sleep(1);
+
+			/* don't change status of service to START_READY */
+			return (FALSE);
+		}
 	}
-    }
 
-    /* check REQUIRE_FILE_AFTER */
-    while ((file = get_next_string(&WAIT_FOR_FILE_AFTER, service, &itt)))
-    {
-	if (stat(file, &file_stat) != 0)
+	/* check REQUIRE_FILE_AFTER */
+	while ((file = get_next_string(&WAIT_FOR_FILE_AFTER, service, &itt)))
 	{
-	    initng_common_mark_service(service, &REQUIRE_FILE_AFTER_FAILED);
-	    return (FALSE);
+		if (stat(file, &file_stat) != 0)
+		{
+			initng_common_mark_service(service, &REQUIRE_FILE_AFTER_FAILED);
+			return (FALSE);
+		}
 	}
-    }
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    S_;
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&WAIT_FOR_FILE);
-    initng_service_data_types_add(&REQUIRE_FILE);
-    initng_service_data_types_add(&WAIT_FOR_FILE_AFTER);
-    initng_service_data_types_add(&REQUIRE_FILE_AFTER);
-
-    initng_active_state_add(&REQUIRE_FILE_FAILED);
-    initng_active_state_add(&REQUIRE_FILE_AFTER_FAILED);
-
-    initng_plugin_hook_add(&g.START_DEP_MET, 55, &check_files_to_exist);
-    initng_plugin_hook_add(&g.UP_MET, 55, &check_files_to_exist_after);
-    return (TRUE);
+	S_;
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&WAIT_FOR_FILE);
+	initng_service_data_types_add(&REQUIRE_FILE);
+	initng_service_data_types_add(&WAIT_FOR_FILE_AFTER);
+	initng_service_data_types_add(&REQUIRE_FILE_AFTER);
+
+	initng_active_state_add(&REQUIRE_FILE_FAILED);
+	initng_active_state_add(&REQUIRE_FILE_AFTER_FAILED);
+
+	initng_plugin_hook_add(&g.START_DEP_MET, 55, &check_files_to_exist);
+	initng_plugin_hook_add(&g.UP_MET, 55, &check_files_to_exist_after);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    S_;
-    initng_service_data_types_del(&WAIT_FOR_FILE);
-    initng_service_data_types_del(&REQUIRE_FILE);
-    initng_service_data_types_del(&WAIT_FOR_FILE_AFTER);
-    initng_service_data_types_del(&REQUIRE_FILE_AFTER);
+	S_;
+	initng_service_data_types_del(&WAIT_FOR_FILE);
+	initng_service_data_types_del(&REQUIRE_FILE);
+	initng_service_data_types_del(&WAIT_FOR_FILE_AFTER);
+	initng_service_data_types_del(&REQUIRE_FILE_AFTER);
 
-    initng_active_state_del(&REQUIRE_FILE_FAILED);
-    initng_active_state_del(&REQUIRE_FILE_AFTER_FAILED);
+	initng_active_state_del(&REQUIRE_FILE_FAILED);
+	initng_active_state_del(&REQUIRE_FILE_AFTER_FAILED);
 
-    initng_plugin_hook_del(&g.START_DEP_MET, &check_files_to_exist);
-    initng_plugin_hook_del(&g.UP_MET, &check_files_to_exist_after);
+	initng_plugin_hook_del(&g.START_DEP_MET, &check_files_to_exist);
+	initng_plugin_hook_del(&g.UP_MET, &check_files_to_exist_after);
 }

Modified: initng/trunk/plugins/history/initng_history.c
==============================================================================
--- initng/trunk/plugins/history/initng_history.c	(original)
+++ initng/trunk/plugins/history/initng_history.c	Wed Apr  5 23:11:19 2006
@@ -20,11 +20,11 @@
 
 #include <initng.h>
 
-#include <sys/types.h>			    /* time_t */
+#include <sys/types.h>						/* time_t */
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <stdio.h>			    /* printf() */
+#include <stdio.h>							/* printf() */
 #include <assert.h>
 #include <errno.h>
 
@@ -45,338 +45,338 @@
 
 static void cmd_history(char *arg, s_payload * payload)
 {
-    int i = 0;
-    history_h *current = NULL;
+	int i = 0;
+	history_h *current = NULL;
 
-    /* allocate space for payload */
-    payload->p = i_calloc(HISTORY + 1, sizeof(active_row));
+	/* allocate space for payload */
+	payload->p = i_calloc(HISTORY + 1, sizeof(active_row));
 
-    while_history_db_prev(current)
-    {
-	active_row *row = payload->p + (i * sizeof(active_row));
-
-	/* if action is not set, it is probably a string logged in this db */
-	if (!current->action)
-	    continue;
-
-	if ((arg && strlen(arg) > 1)
-	    && !(((current->name) && strcmp(current->name, arg) == 0)
-		 || ((current->service && current->service->name)
-		     && strcmp(current->service->name, arg) == 0)))
-	    continue;
-
-	if (current->data)
-	    printf("%s\n", current->data);
-
-	if (current->action)
-	    strncpy(row->state, current->action->state_name, 100);
-	else
-	    row->state[0] = '\0';
-
-	memcpy(&row->time_set, &current->time, sizeof(struct timeval));
-	if (current->name)
-	    strncpy(row->name, current->name, 100);
-	else if (current->service && current->service->name)
-	    strncpy(row->name, current->service->name, 100);
-	else
-	    row->name[0] = '\0';
-
-	/* set the rought state */
-	row->is = current->action->is;
-
-	/* increase the number of entrys to send */
-	i++;
-    }
+	while_history_db_prev(current)
+	{
+		active_row *row = payload->p + (i * sizeof(active_row));
+
+		/* if action is not set, it is probably a string logged in this db */
+		if (!current->action)
+			continue;
+
+		if ((arg && strlen(arg) > 1)
+			&& !(((current->name) && strcmp(current->name, arg) == 0)
+				 || ((current->service && current->service->name)
+					 && strcmp(current->service->name, arg) == 0)))
+			continue;
+
+		if (current->data)
+			printf("%s\n", current->data);
+
+		if (current->action)
+			strncpy(row->state, current->action->state_name, 100);
+		else
+			row->state[0] = '\0';
+
+		memcpy(&row->time_set, &current->time, sizeof(struct timeval));
+		if (current->name)
+			strncpy(row->name, current->name, 100);
+		else if (current->service && current->service->name)
+			strncpy(row->name, current->service->name, 100);
+		else
+			row->name[0] = '\0';
+
+		/* set the rought state */
+		row->is = current->action->is;
 
-    payload->s = i * sizeof(active_row);
+		/* increase the number of entrys to send */
+		i++;
+	}
+
+	payload->s = i * sizeof(active_row);
 }
 
 
 s_command HISTORYS = { 'L', "show_history", DATA_ACTIVE_ROW, STANDARD_COMMAND, USES_OPT,
-    {(void *) &cmd_history},
-    "Print out history_db."
+	{(void *) &cmd_history},
+	"Print out history_db."
 };
 
 static char *cmd_log(char *arg)
 {
-    char *string = NULL;
-    char *name = NULL;
-    char *latest = NULL;
-    struct tm *ts;
-    int only_output = FALSE;
-    history_h *current = NULL;
-
-
-    /* reset arg, if strlen is short */
-    if (arg)
-    {
-	if (strlen(arg) < 1)
-	    arg = NULL;
-	else if (strcmp(arg, "output") == 0)
-	    only_output = TRUE;
-    }
-
-    mprintf(&string, " hh:mm:ss    service           :  STATUS\n");
-    mprintf(&string,
-	    " ------------------------------------------------------\n");
-    while_history_db_prev(current)
-    {
-	/* if only_output is set, it have to be an output to continue */
-	if (only_output && !current->data)
-	    continue;
-
-	/* if there is an argument, it have to match the service */
-	if (arg
-	    && !(((current->name) && strcmp(current->name, arg) == 0)
-		 || ((current->service && current->service->name)
-		     && strcmp(current->service->name, arg) == 0)))
-	    continue;
-
-	/* try to set the service name, from any source found */
-	if (current->name)
-	    name = current->name;
-	else if (current->service && current->service->name)
-	    name = current->service->name;
-	else
-	    name = NULL;
-
-	/* create an localtime struct form service->time */
-	ts = localtime(&current->time.tv_sec);
-
-	/* if the log entry contains output data ... */
-	if (current->data)
-	{
-	    if (latest == name)
-		mprintf(&string, "%s", current->data);
-	    else
-		mprintf(&string, " %.2i:%.2i:%.2i %20s : *OUTPUT*\n%s",
-			ts->tm_hour, ts->tm_min, ts->tm_sec, name,
-			current->data);
-	    latest = name;
-	}
-	else
-	{
-	    if (current->action->is == IS_UP || current->action->is == IS_DOWN
-		|| current->action->is == IS_FAILED)
-	    {
-		/* reset so that *OUTPUT* will be shown again */
-		latest = NULL;
-
-		/* print a nice service change status entry */
-		mprintf(&string, " %.2i:%.2i:%.2i %20s : %s\n", ts->tm_hour,
-			ts->tm_min, ts->tm_sec, name,
-			current->action->state_name);
-	    }
+	char *string = NULL;
+	char *name = NULL;
+	char *latest = NULL;
+	struct tm *ts;
+	int only_output = FALSE;
+	history_h *current = NULL;
+
+
+	/* reset arg, if strlen is short */
+	if (arg)
+	{
+		if (strlen(arg) < 1)
+			arg = NULL;
+		else if (strcmp(arg, "output") == 0)
+			only_output = TRUE;
 	}
 
-    }
-    return (string);
+	mprintf(&string, " hh:mm:ss    service           :  STATUS\n");
+	mprintf(&string,
+			" ------------------------------------------------------\n");
+	while_history_db_prev(current)
+	{
+		/* if only_output is set, it have to be an output to continue */
+		if (only_output && !current->data)
+			continue;
+
+		/* if there is an argument, it have to match the service */
+		if (arg
+			&& !(((current->name) && strcmp(current->name, arg) == 0)
+				 || ((current->service && current->service->name)
+					 && strcmp(current->service->name, arg) == 0)))
+			continue;
+
+		/* try to set the service name, from any source found */
+		if (current->name)
+			name = current->name;
+		else if (current->service && current->service->name)
+			name = current->service->name;
+		else
+			name = NULL;
+
+		/* create an localtime struct form service->time */
+		ts = localtime(&current->time.tv_sec);
+
+		/* if the log entry contains output data ... */
+		if (current->data)
+		{
+			if (latest == name)
+				mprintf(&string, "%s", current->data);
+			else
+				mprintf(&string, " %.2i:%.2i:%.2i %20s : *OUTPUT*\n%s",
+						ts->tm_hour, ts->tm_min, ts->tm_sec, name,
+						current->data);
+			latest = name;
+		}
+		else
+		{
+			if (current->action->is == IS_UP || current->action->is == IS_DOWN
+				|| current->action->is == IS_FAILED)
+			{
+				/* reset so that *OUTPUT* will be shown again */
+				latest = NULL;
+
+				/* print a nice service change status entry */
+				mprintf(&string, " %.2i:%.2i:%.2i %20s : %s\n", ts->tm_hour,
+						ts->tm_min, ts->tm_sec, name,
+						current->action->state_name);
+			}
+		}
+
+	}
+	return (string);
 }
 
 
 s_command LOG = { 'l', "log", STRING_COMMAND, STANDARD_COMMAND, USES_OPT,
-    {(void *) &cmd_log},
-    "Print out log."
+	{(void *) &cmd_log},
+	"Print out log."
 };
 
 
 
 static void history_db_compensate_time(time_t skew)
 {
-    history_h *current = NULL;
+	history_h *current = NULL;
 
-    D_("history_db_compensate_time(%i);\n", (int) skew);
+	D_("history_db_compensate_time(%i);\n", (int) skew);
 
-    while_history_db(current)
-    {
-	current->time.tv_sec += skew;
-    }
+	while_history_db(current)
+	{
+		current->time.tv_sec += skew;
+	}
 }
 
 
 
 static void history_db_clear_service(active_db_h * service)
 {
-    history_h *current = NULL;
+	history_h *current = NULL;
 
-    D_("history_db_clear_service(%s);\n", service->name);
+	D_("history_db_clear_service(%s);\n", service->name);
 
-    while_history_db(current)
-    {
-	if (current->service == service)
+	while_history_db(current)
 	{
-	    current->service = NULL;
-	    current->name = i_strdup(service->name);
+		if (current->service == service)
+		{
+			current->service = NULL;
+			current->name = i_strdup(service->name);
+		}
 	}
-    }
 }
 
 /* clear history */
 static void history_free_all(void)
 {
-    history_h *current, *safe = NULL;
+	history_h *current, *safe = NULL;
+
+	/* while there is a history db */
+	while_history_db_safe(current, safe)
+	{
+		/* free history name */
+		if (current->name)
+			free(current->name);
+
+		/* free data if any */
+		if (current->data)
+			free(current->data);
+
+		/* remove from history_db list */
+		list_del(&current->list);
 
-    /* while there is a history db */
-    while_history_db_safe(current, safe)
-    {
-	/* free history name */
-	if (current->name)
-	    free(current->name);
-
-	/* free data if any */
-	if (current->data)
-	    free(current->data);
-
-	/* remove from history_db list */
-	list_del(&current->list);
-
-	/* free history entry */
-	free(current);
-    }
+		/* free history entry */
+		free(current);
+	}
 }
 
 static int add_hist(history_h * hist)
 {
-    /* add struct */
-    list_add(&hist->list, &history_db.list);
-
-    /* check length of history_db, and purge it on the end! */
-    history_records++;
-
-    /* If maximum entrys are reached */
-    if (history_records > HISTORY)
-    {
+	/* add struct */
+	list_add(&hist->list, &history_db.list);
 
-	struct list_head *last = history_db.list.prev;
-	history_h *entry = list_entry(last, history_h, list);
+	/* check length of history_db, and purge it on the end! */
+	history_records++;
 
-	/* if we got anything */
-	if (!entry)
+	/* If maximum entrys are reached */
+	if (history_records > HISTORY)
 	{
-	    F_("Unable to free last histroty entry!, cant add more.\n");
-	    return (FALSE);
-	}
 
-	/* free the name */
-	if (entry->name)
-	    free(entry->name);
+		struct list_head *last = history_db.list.prev;
+		history_h *entry = list_entry(last, history_h, list);
 
-	/* free any data that might be in this history entry */
-	if (entry->data)
-	    free(entry->data);
+		/* if we got anything */
+		if (!entry)
+		{
+			F_("Unable to free last histroty entry!, cant add more.\n");
+			return (FALSE);
+		}
+
+		/* free the name */
+		if (entry->name)
+			free(entry->name);
+
+		/* free any data that might be in this history entry */
+		if (entry->data)
+			free(entry->data);
 
-	/* delete this from the historylist */
-	list_del(last);
+		/* delete this from the historylist */
+		list_del(last);
 
-	/* free the struct */
-	free(entry);
+		/* free the struct */
+		free(entry);
 
-	/* count down the number of records */
-	history_records--;
-    }
+		/* count down the number of records */
+		history_records--;
+	}
 
-    /* leave */
-    return (TRUE);
+	/* leave */
+	return (TRUE);
 }
 
 /* add values to history database */
 static int history_add_values(active_db_h * service)
 {
-    history_h *tmp_e = NULL;	/* temporary pointer to insert data and add to db */
+	history_h *tmp_e = NULL;	/* temporary pointer to insert data and add to db */
 
-    assert(service->name);
+	assert(service->name);
 
-    /* Don't bother adding */
-    if (!service->current_state)
-	return (TRUE);
+	/* Don't bother adding */
+	if (!service->current_state)
+		return (TRUE);
 
-    /*if (!service->current_state->state_name);
-       return(TRUE); */
+	/*if (!service->current_state->state_name);
+	   return(TRUE); */
 
-    D_("adding: %s.\n", service->name);
+	D_("adding: %s.\n", service->name);
 
-    /* allocate space for data */
-    if (!(tmp_e = (history_h *) i_calloc(1, sizeof(history_h))))
-    {
-	F_("Out of memory.\n");
-	return (TRUE);
-    }
+	/* allocate space for data */
+	if (!(tmp_e = (history_h *) i_calloc(1, sizeof(history_h))))
+	{
+		F_("Out of memory.\n");
+		return (TRUE);
+	}
 
-    /* set data in struct */
-    tmp_e->service = service;
-    tmp_e->name = NULL;
-    memcpy(&tmp_e->time, &service->time_current_state,
-	   sizeof(struct timeval));
-    tmp_e->action = service->current_state;
-
-    /*D_("history_add_values() service : %s, name: %s, action: %s\n", service->name, NULL, service->current_state->state_name); */
-
-    add_hist(tmp_e);
-
-    /* if service is status freeing, clear the pointers in history db */
-    if (IS_MARK(service, &FREEING))
-    {
-	history_db_clear_service(service);
-    }
+	/* set data in struct */
+	tmp_e->service = service;
+	tmp_e->name = NULL;
+	memcpy(&tmp_e->time, &service->time_current_state,
+		   sizeof(struct timeval));
+	tmp_e->action = service->current_state;
+
+	/*D_("history_add_values() service : %s, name: %s, action: %s\n", service->name, NULL, service->current_state->state_name); */
+
+	add_hist(tmp_e);
+
+	/* if service is status freeing, clear the pointers in history db */
+	if (IS_MARK(service, &FREEING))
+	{
+		history_db_clear_service(service);
+	}
 
-    /* leave */
-    return (TRUE);
+	/* leave */
+	return (TRUE);
 }
 
 static int fetch_output(active_db_h * service, process_h * process,
-			char *buffer_pos)
+						char *buffer_pos)
 {
-    history_h *tmp_e = NULL;
+	history_h *tmp_e = NULL;
 
-    /* allocate space for data */
-    if (!(tmp_e = (history_h *) i_calloc(1, sizeof(history_h))))
-    {
-	F_("Out of memory.\n");
-	return (FALSE);
-    }
-
-    /* set data in struct */
-    tmp_e->service = service;
-    tmp_e->name = NULL;
-    gettimeofday(&tmp_e->time, NULL);
-    tmp_e->data = i_strdup(buffer_pos);
-    tmp_e->action = NULL;
+	/* allocate space for data */
+	if (!(tmp_e = (history_h *) i_calloc(1, sizeof(history_h))))
+	{
+		F_("Out of memory.\n");
+		return (FALSE);
+	}
 
-    /* add to history struct */
-    add_hist(tmp_e);
+	/* set data in struct */
+	tmp_e->service = service;
+	tmp_e->name = NULL;
+	gettimeofday(&tmp_e->time, NULL);
+	tmp_e->data = i_strdup(buffer_pos);
+	tmp_e->action = NULL;
 
-    return (TRUE);
+	/* add to history struct */
+	add_hist(tmp_e);
+
+	return (TRUE);
 }
 
 
 
 int module_init(int api_version)
 {
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    INIT_LIST_HEAD(&history_db.list);
-
-    initng_command_add(&HISTORYS);
-    initng_command_add(&LOG);
-    initng_plugin_hook_add(&g.ASTATUS_CHANGE, 1000, &history_add_values);
-    initng_plugin_hook_add(&g.COMPENSATE_TIME, 50,
-			   &history_db_compensate_time);
-    initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &fetch_output);
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	INIT_LIST_HEAD(&history_db.list);
 
-    return (TRUE);
+	initng_command_add(&HISTORYS);
+	initng_command_add(&LOG);
+	initng_plugin_hook_add(&g.ASTATUS_CHANGE, 1000, &history_add_values);
+	initng_plugin_hook_add(&g.COMPENSATE_TIME, 50,
+						   &history_db_compensate_time);
+	initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &fetch_output);
+
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    initng_command_del(&HISTORYS);
-    initng_command_del(&LOG);
-    history_free_all();
-    initng_plugin_hook_del(&g.ASTATUS_CHANGE, &history_add_values);
-    initng_plugin_hook_del(&g.COMPENSATE_TIME, &history_db_compensate_time);
-    initng_plugin_hook_del(&g.PIPEWATCHERS, &fetch_output);
+	initng_command_del(&HISTORYS);
+	initng_command_del(&LOG);
+	history_free_all();
+	initng_plugin_hook_del(&g.ASTATUS_CHANGE, &history_add_values);
+	initng_plugin_hook_del(&g.COMPENSATE_TIME, &history_db_compensate_time);
+	initng_plugin_hook_del(&g.PIPEWATCHERS, &fetch_output);
 }

Modified: initng/trunk/plugins/history/initng_history.h
==============================================================================
--- initng/trunk/plugins/history/initng_history.h	(original)
+++ initng/trunk/plugins/history/initng_history.h	Wed Apr  5 23:11:19 2006
@@ -32,13 +32,13 @@
 typedef struct history_s history_h;
 struct history_s
 {
-    active_db_h *service;
-    char *name;
-    struct timeval time;
-    char *data;
-    a_state_h *action;
+	active_db_h *service;
+	char *name;
+	struct timeval time;
+	char *data;
+	a_state_h *action;
 
-    struct list_head list;
+	struct list_head list;
 };
 
 

Modified: initng/trunk/plugins/idleprobe/initng_idleprobe.c
==============================================================================
--- initng/trunk/plugins/idleprobe/initng_idleprobe.c	(original)
+++ initng/trunk/plugins/idleprobe/initng_idleprobe.c	Wed Apr  5 23:11:19 2006
@@ -22,7 +22,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -59,12 +59,12 @@
 
 /* system have to be idle for 10 seconds */
 s_entry WAIT_FOR_CPU_IDLE = { "wait_for_cpu_idle", SET, NULL,
-    "If this is set, initng will wait until CPU has been idling for 10 seconds before starting."
+	"If this is set, initng will wait until CPU has been idling for 10 seconds before starting."
 };
 
 /* set the seconds system have to be idle */
 s_entry WAIT_FOR_CPU_COUNT = { "wait_for_cpu_below", INT, NULL,
-    "Sets the seconds system have to idle, before this service is started."
+	"Sets the seconds system have to idle, before this service is started."
 };
 
 ull_t old_cpu_user = 0;
@@ -78,153 +78,153 @@
 
 static int is_cpu_idle(int wait)
 {
-    static ull_t cpu_user, cpu_nice, cpu_system, cpu_idle;
-    static ull_t cpu_dummy1, cpu_dummy2, cpu_dummy3;
-    static ll_t cpu_user_frm, cpu_nice_frm, cpu_system_frm, cpu_idle_frm;
-    static ll_t cpu_dummy1_frm, cpu_dummy2_frm, cpu_dummy3_frm, cpu_tot_frm;
-
-    static char buf[256 + 64];
-    static int idle_cnt = 0;
-
-    float scale;
-
-    D_("is_cpu_idle(%i);\n", wait);
-    /* check so that wait value is correct */
-    if (wait < 0)
-    {
-	F_("Wrong value for parameter wait_for_cpu_idle (%i)!\n", wait);
-	return (FALSE);
-    }
+	static ull_t cpu_user, cpu_nice, cpu_system, cpu_idle;
+	static ull_t cpu_dummy1, cpu_dummy2, cpu_dummy3;
+	static ll_t cpu_user_frm, cpu_nice_frm, cpu_system_frm, cpu_idle_frm;
+	static ll_t cpu_dummy1_frm, cpu_dummy2_frm, cpu_dummy3_frm, cpu_tot_frm;
+
+	static char buf[256 + 64];
+	static int idle_cnt = 0;
+
+	float scale;
+
+	D_("is_cpu_idle(%i);\n", wait);
+	/* check so that wait value is correct */
+	if (wait < 0)
+	{
+		F_("Wrong value for parameter wait_for_cpu_idle (%i)!\n", wait);
+		return (FALSE);
+	}
 
-    /* Make sure this is maximum run once every second, and mainloop */
-    if (g.now.tv_sec == last)
-    {
-	/* make sure rerun interrupt again in 1 second */
-	initng_global_set_sleep(1);
-	return (FALSE);
-    }
+	/* Make sure this is maximum run once every second, and mainloop */
+	if (g.now.tv_sec == last)
+	{
+		/* make sure rerun interrupt again in 1 second */
+		initng_global_set_sleep(1);
+		return (FALSE);
+	}
 
-    /* update last run counter */
-    last = g.now.tv_sec;
+	/* update last run counter */
+	last = g.now.tv_sec;
 
-    /* if fp_proc not open, try to open it */
-    if (!fp_proc)
-    {
-	fp_proc = fopen("/proc/stat", "r");
-    }
+	/* if fp_proc not open, try to open it */
+	if (!fp_proc)
+	{
+		fp_proc = fopen("/proc/stat", "r");
+	}
 
-    /* if still not open, return false */
-    if (!fp_proc)
-	return (FALSE);
+	/* if still not open, return false */
+	if (!fp_proc)
+		return (FALSE);
 
 
-    rewind(fp_proc);
-    fflush(fp_proc);
+	rewind(fp_proc);
+	fflush(fp_proc);
 
-    // first value the CPU summary line
-    if (!fgets(buf, sizeof(buf), fp_proc))
-    {
-	F_("Failed to read from /proc/stat!\n");
-	return (FALSE);
-    }
+	// first value the CPU summary line
+	if (!fgets(buf, sizeof(buf), fp_proc))
+	{
+		F_("Failed to read from /proc/stat!\n");
+		return (FALSE);
+	}
 
-    /* okay, lets start parse /proc/stat */
-    if (sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
-	       &cpu_user,
-	       &cpu_nice,
-	       &cpu_system,
-	       &cpu_idle, &cpu_dummy1, &cpu_dummy2, &cpu_dummy3) < 4)
-    {
-	F_("Failed to read from /proc/stat!\n");
-	return (FALSE);
-    }
+	/* okay, lets start parse /proc/stat */
+	if (sscanf(buf, "cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu",
+			   &cpu_user,
+			   &cpu_nice,
+			   &cpu_system,
+			   &cpu_idle, &cpu_dummy1, &cpu_dummy2, &cpu_dummy3) < 4)
+	{
+		F_("Failed to read from /proc/stat!\n");
+		return (FALSE);
+	}
 
-    D_("cpu_user: %i\n", (int) cpu_user);
-    D_("cpu_nice: %i\n", (int) cpu_nice);
-    D_("cpu_system: %i\n", (int) cpu_system);
-    D_("cpu_idle: %i\n\n", (int) cpu_idle);
-
-    cpu_user_frm = cpu_user - old_cpu_user;
-    cpu_nice_frm = cpu_nice - old_cpu_nice;
-    cpu_system_frm = cpu_system - old_cpu_system;
-    cpu_idle_frm = cpu_idle > old_cpu_idle ? cpu_idle - old_cpu_idle : 0;
-    cpu_dummy1_frm = cpu_dummy1 - old_cpu_dummy1;
-    cpu_dummy2_frm = cpu_dummy2 - old_cpu_dummy2;
-    cpu_dummy3_frm = cpu_dummy3 - old_cpu_dummy3;
-    cpu_tot_frm = cpu_user_frm + cpu_nice_frm + cpu_system_frm + cpu_idle_frm + cpu_dummy1_frm + cpu_dummy2_frm + cpu_dummy3_frm;
-    if (cpu_tot_frm < 1)
-	cpu_tot_frm = 1;
-    scale = 100.0 / (float) cpu_tot_frm;
-
-    if (old_cpu_user)
-    {
-	if ((float) cpu_idle_frm * scale > 90.0)
-	{
-	    D_("idle_cnt: %i\n", idle_cnt);
-	    if (++idle_cnt > wait)
-		return (TRUE);
-	}
-	else
-	{
-	    idle_cnt = 0;
-	}
-    }
-
-    old_cpu_user = cpu_user;
-    old_cpu_nice = cpu_nice;
-    old_cpu_system = cpu_system;
-    old_cpu_idle = cpu_idle;
-    old_cpu_dummy1 = cpu_dummy1;
-    old_cpu_dummy2 = cpu_dummy2;
-    old_cpu_dummy3 = cpu_dummy3;
+	D_("cpu_user: %i\n", (int) cpu_user);
+	D_("cpu_nice: %i\n", (int) cpu_nice);
+	D_("cpu_system: %i\n", (int) cpu_system);
+	D_("cpu_idle: %i\n\n", (int) cpu_idle);
+
+	cpu_user_frm = cpu_user - old_cpu_user;
+	cpu_nice_frm = cpu_nice - old_cpu_nice;
+	cpu_system_frm = cpu_system - old_cpu_system;
+	cpu_idle_frm = cpu_idle > old_cpu_idle ? cpu_idle - old_cpu_idle : 0;
+	cpu_dummy1_frm = cpu_dummy1 - old_cpu_dummy1;
+	cpu_dummy2_frm = cpu_dummy2 - old_cpu_dummy2;
+	cpu_dummy3_frm = cpu_dummy3 - old_cpu_dummy3;
+	cpu_tot_frm = cpu_user_frm + cpu_nice_frm + cpu_system_frm + cpu_idle_frm + cpu_dummy1_frm + cpu_dummy2_frm + cpu_dummy3_frm;
+	if (cpu_tot_frm < 1)
+		cpu_tot_frm = 1;
+	scale = 100.0 / (float) cpu_tot_frm;
 
-    /* make sure this will at least be run in one second */
-    initng_global_set_sleep(1);
+	if (old_cpu_user)
+	{
+		if ((float) cpu_idle_frm * scale > 90.0)
+		{
+			D_("idle_cnt: %i\n", idle_cnt);
+			if (++idle_cnt > wait)
+				return (TRUE);
+		}
+		else
+		{
+			idle_cnt = 0;
+		}
+	}
+
+	old_cpu_user = cpu_user;
+	old_cpu_nice = cpu_nice;
+	old_cpu_system = cpu_system;
+	old_cpu_idle = cpu_idle;
+	old_cpu_dummy1 = cpu_dummy1;
+	old_cpu_dummy2 = cpu_dummy2;
+	old_cpu_dummy3 = cpu_dummy3;
+
+	/* make sure this will at least be run in one second */
+	initng_global_set_sleep(1);
 
-    return (FALSE);
+	return (FALSE);
 }
 
 static int check_cpu_idle(active_db_h * service)
 {
-    S_;
-    int value = 0;
+	S_;
+	int value = 0;
 
 
 
-    if ((value = get_int(&WAIT_FOR_CPU_COUNT, service)) > 0)
-    {
-	return (is_cpu_idle(value));
-    }
+	if ((value = get_int(&WAIT_FOR_CPU_COUNT, service)) > 0)
+	{
+		return (is_cpu_idle(value));
+	}
 
-    if (is(&WAIT_FOR_CPU_IDLE, service))
-	return (is_cpu_idle(DEFAULT_IDLE));
+	if (is(&WAIT_FOR_CPU_IDLE, service))
+		return (is_cpu_idle(DEFAULT_IDLE));
 
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    S_;
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	S_;
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&WAIT_FOR_CPU_IDLE);
-    initng_service_data_types_add(&WAIT_FOR_CPU_COUNT);
-    initng_plugin_hook_add(&g.START_DEP_MET, 90, &check_cpu_idle);
-    return (TRUE);
+	initng_service_data_types_add(&WAIT_FOR_CPU_IDLE);
+	initng_service_data_types_add(&WAIT_FOR_CPU_COUNT);
+	initng_plugin_hook_add(&g.START_DEP_MET, 90, &check_cpu_idle);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    S_;
-    initng_service_data_types_del(&WAIT_FOR_CPU_IDLE);
-    initng_service_data_types_del(&WAIT_FOR_CPU_COUNT);
-    initng_plugin_hook_del(&g.START_DEP_MET, &check_cpu_idle);
+	S_;
+	initng_service_data_types_del(&WAIT_FOR_CPU_IDLE);
+	initng_service_data_types_del(&WAIT_FOR_CPU_COUNT);
+	initng_plugin_hook_del(&g.START_DEP_MET, &check_cpu_idle);
 
-    if (fp_proc)
-	fclose(fp_proc);
+	if (fp_proc)
+		fclose(fp_proc);
 }

Modified: initng/trunk/plugins/initctl/initng_initctl.c
==============================================================================
--- initng/trunk/plugins/initctl/initng_initctl.c	(original)
+++ initng/trunk/plugins/initctl/initng_initctl.c	Wed Apr  5 23:11:19 2006
@@ -65,215 +65,215 @@
 
 struct stat st, st2;
 
-#define PIPE_FD    10			    /* Fileno of initfifo. */
+#define PIPE_FD    10						/* Fileno of initfifo. */
 
 static void initctl_control_close(void)
 {
-    if (pipe_fd.fds > 2)
-    {
-	close(pipe_fd.fds);
-	pipe_fd.fds = -1;
-    }
+	if (pipe_fd.fds > 2)
+	{
+		close(pipe_fd.fds);
+		pipe_fd.fds = -1;
+	}
 }
 
 static int initctl_control_open(void)
 {
-    D_("initctl control open (%d)\n", pipe_fd.fds);
-    /* First, try to create /dev/initctl if not present. */
-    if (stat(INIT_FIFO, &st2) < 0 && errno == ENOENT)
-	(void) mkfifo(INIT_FIFO, 0600);
-
-    /*
-     *  If /dev/initctl is open, stat the file to see if it
-     *  is still the _same_ inode.
-     */
-    if (pipe_fd.fds > 2)
-    {
-	if (fstat(pipe_fd.fds, &st) < 0)
-	    initctl_control_close();
-	if (stat(INIT_FIFO, &st2) < 0 || st.st_dev != st2.st_dev
-	    || st.st_ino != st2.st_ino)
-	{
-	    initctl_control_close();
-	}
-    }
-
-    /* If the pipe isn't open, try to open it. */
-    if (pipe_fd.fds < 3)
-    {
-	/* it the file descriptor has to be over 2 to be valid */
-	if ((pipe_fd.fds = open(INIT_FIFO, O_RDWR | O_NONBLOCK)) < 3)
-	    return (FALSE);
-
-	D_("Opened on fd %i\n", pipe_fd.fds);
-	fstat(pipe_fd.fds, &st);
-	if (!S_ISFIFO(st.st_mode))
-	{
-	    /* /dev/initctl is there, but we can't open it */
-	    F_("%s is not a fifo\n", INIT_FIFO);
-	    if (pipe_fd.fds >= 0)
-	    {
-		close(pipe_fd.fds);
-		pipe_fd.fds = -1;
-	    }
-	    return (FALSE);
+	D_("initctl control open (%d)\n", pipe_fd.fds);
+	/* First, try to create /dev/initctl if not present. */
+	if (stat(INIT_FIFO, &st2) < 0 && errno == ENOENT)
+		(void) mkfifo(INIT_FIFO, 0600);
+
+	/*
+	 *  If /dev/initctl is open, stat the file to see if it
+	 *  is still the _same_ inode.
+	 */
+	if (pipe_fd.fds > 2)
+	{
+		if (fstat(pipe_fd.fds, &st) < 0)
+			initctl_control_close();
+		if (stat(INIT_FIFO, &st2) < 0 || st.st_dev != st2.st_dev
+			|| st.st_ino != st2.st_ino)
+		{
+			initctl_control_close();
+		}
 	}
 
-	/* ok, finally add hook */
-	initng_plugin_hook_add(&g.FDWATCHERS, 70, &pipe_fd);
-    }
-    return (TRUE);
+	/* If the pipe isn't open, try to open it. */
+	if (pipe_fd.fds < 3)
+	{
+		/* it the file descriptor has to be over 2 to be valid */
+		if ((pipe_fd.fds = open(INIT_FIFO, O_RDWR | O_NONBLOCK)) < 3)
+			return (FALSE);
+
+		D_("Opened on fd %i\n", pipe_fd.fds);
+		fstat(pipe_fd.fds, &st);
+		if (!S_ISFIFO(st.st_mode))
+		{
+			/* /dev/initctl is there, but we can't open it */
+			F_("%s is not a fifo\n", INIT_FIFO);
+			if (pipe_fd.fds >= 0)
+			{
+				close(pipe_fd.fds);
+				pipe_fd.fds = -1;
+			}
+			return (FALSE);
+		}
+
+		/* ok, finally add hook */
+		initng_plugin_hook_add(&g.FDWATCHERS, 70, &pipe_fd);
+	}
+	return (TRUE);
 }
 
 /* To be called when there is input on the control bus */
 void parse_control_input(f_module_h * from_module, e_fdw what)
 {
-    int n;
-    struct init_request request;
+	int n;
+	struct init_request request;
 
-    if (from_module != &pipe_fd)
-	return;
+	if (from_module != &pipe_fd)
+		return;
 
-    /* Read data from /dev/initctl */
-    n = read(pipe_fd.fds, &request, sizeof(request));
+	/* Read data from /dev/initctl */
+	n = read(pipe_fd.fds, &request, sizeof(request));
 
-    /* Check if request is ok : */
-    if (n == 0)
-    {
-	F_("read 0 bytes, this should never happen!\n");
-	return;
-    }
-    if (n <= 0)
-    {
-	if (errno == EINTR)
-	    return;
-	F_("Error reading request\n");
-	return;
-    }
-    if (request.magic != INIT_MAGIC || n != sizeof(request))
-    {
-	F_("got bogus init request\n");
-	return;
-    }
+	/* Check if request is ok : */
+	if (n == 0)
+	{
+		F_("read 0 bytes, this should never happen!\n");
+		return;
+	}
+	if (n <= 0)
+	{
+		if (errno == EINTR)
+			return;
+		F_("Error reading request\n");
+		return;
+	}
+	if (request.magic != INIT_MAGIC || n != sizeof(request))
+	{
+		F_("got bogus init request\n");
+		return;
+	}
 
-    /*
-     * Check that the request command is a valid one.
-     */
-    if (request.cmd != INIT_CMD_RUNLVL)
-    {
-	D_("got unimplemented init request - %d (%c),%d (%c).\n",
-	   request.runlevel, request.runlevel, request.cmd, request.cmd);
-	return;
-    }
+	/*
+	 * Check that the request command is a valid one.
+	 */
+	if (request.cmd != INIT_CMD_RUNLVL)
+	{
+		D_("got unimplemented init request - %d (%c),%d (%c).\n",
+		   request.runlevel, request.runlevel, request.cmd, request.cmd);
+		return;
+	}
+
+	/* TODO, handle these:
+	   #define INIT_CMD_START              0
+	   #define INIT_CMD_RUNLVL        1
+	   #define INIT_CMD_POWERFAIL     2
+	   #define INIT_CMD_POWERFAILNOW  3
+	   #define INIT_CMD_POWEROK       4
+	 */
+
+	/* Request is OK, handle it: */
+	D_("init data is : - %d (%c),%d (%c).\n", request.runlevel,
+	   request.runlevel, request.cmd, request.cmd);
 
-    /* TODO, handle these:
-       #define INIT_CMD_START              0
-       #define INIT_CMD_RUNLVL        1
-       #define INIT_CMD_POWERFAIL     2
-       #define INIT_CMD_POWERFAILNOW  3
-       #define INIT_CMD_POWEROK       4
-     */
-
-    /* Request is OK, handle it: */
-    D_("init data is : - %d (%c),%d (%c).\n", request.runlevel,
-       request.runlevel, request.cmd, request.cmd);
-
-    switch (request.runlevel)
-    {
-	    /* halting */
-	case '0':
-	    D_("Halting.\n");
-	    g.when_out = THEN_POWEROFF;
-	    initng_handler_stop_all();
-	    return;
-
-	    /* reboot */
-	case '6':
-	    D_("Rebooting.\n");
-	    g.when_out = THEN_REBOOT;
-	    initng_handler_stop_all();
-	    return;
-
-	    /* restart init */
-	case 'U':
-	case 'u':
-	    D_("init U, sent reloading initng\n");
-	    initng_reload();
-	    return;
-
-	    /* reload /etc/inittab */
-	case 'Q':
-	case 'q':
-	    D_("init Q, freeing complete service cache\n");
-	    initng_service_cache_free_all();
-	    return;
-
-	    /* go singleuser */
-	case 'S':
-	case 's':
-	    W_("init S, going singleuser\n");
-	    g.when_out = THEN_RESTART;
-
-	    /* set next runlevel to single (That will be loaded when no service is left in current one) */
-	    initng_main_set_runlevel("single");
-	    initng_handler_stop_all();
-	    return;
-	default:
-	    D_("Starting runlevel%c\n", request.runlevel);
-	    {
-		char tmp[20];
-
-		sprintf(tmp, "runlevel%c", request.runlevel);
-		if (!initng_handler_start_new_service_named(tmp))
-		    F_(" service \"%s\" could not be executed.\n", tmp);
-	    }
-	    return;
-    }
+	switch (request.runlevel)
+	{
+			/* halting */
+		case '0':
+			D_("Halting.\n");
+			g.when_out = THEN_POWEROFF;
+			initng_handler_stop_all();
+			return;
+
+			/* reboot */
+		case '6':
+			D_("Rebooting.\n");
+			g.when_out = THEN_REBOOT;
+			initng_handler_stop_all();
+			return;
+
+			/* restart init */
+		case 'U':
+		case 'u':
+			D_("init U, sent reloading initng\n");
+			initng_reload();
+			return;
+
+			/* reload /etc/inittab */
+		case 'Q':
+		case 'q':
+			D_("init Q, freeing complete service cache\n");
+			initng_service_cache_free_all();
+			return;
+
+			/* go singleuser */
+		case 'S':
+		case 's':
+			W_("init S, going singleuser\n");
+			g.when_out = THEN_RESTART;
+
+			/* set next runlevel to single (That will be loaded when no service is left in current one) */
+			initng_main_set_runlevel("single");
+			initng_handler_stop_all();
+			return;
+		default:
+			D_("Starting runlevel%c\n", request.runlevel);
+			{
+				char tmp[20];
+
+				sprintf(tmp, "runlevel%c", request.runlevel);
+				if (!initng_handler_start_new_service_named(tmp))
+					F_(" service \"%s\" could not be executed.\n", tmp);
+			}
+			return;
+	}
 }
 
 static void makeutmp(int runlevel)
 {
-    D_("Making utmp file for runlevel %d\n", runlevel);
-    struct utmp utmp;
-    time_t t;
-
-    /*
-     * this is created by bootmisc, if this isn't there we can't set runlevel.
-     */
-    if (access(UTMP_FILE, F_OK) < 0)
-    {
-	F_("/var/run/utmp does not exist, this should be created by bootmisc.i\n");
-	return;
-    }
-    /*
-       TODO, is this a good idea or a bad idea?
-       utmpname("/var/run/utmp");
-     */
-
-    setutent();
-    memset(&utmp, 0, sizeof(utmp));
-    utmp.ut_type = RUN_LVL;
-    utmp.ut_pid = ('#' << 8) + runlevel + '0';
-    time(&t);
-    utmp.ut_time = (int) t;
-    if (pututline(&utmp) == NULL)
-    {
-	F_("pututline failed\n");
+	D_("Making utmp file for runlevel %d\n", runlevel);
+	struct utmp utmp;
+	time_t t;
+
+	/*
+	 * this is created by bootmisc, if this isn't there we can't set runlevel.
+	 */
+	if (access(UTMP_FILE, F_OK) < 0)
+	{
+		F_("/var/run/utmp does not exist, this should be created by bootmisc.i\n");
+		return;
+	}
+	/*
+	   TODO, is this a good idea or a bad idea?
+	   utmpname("/var/run/utmp");
+	 */
+
+	setutent();
+	memset(&utmp, 0, sizeof(utmp));
+	utmp.ut_type = RUN_LVL;
+	utmp.ut_pid = ('#' << 8) + runlevel + '0';
+	time(&t);
+	utmp.ut_time = (int) t;
+	if (pututline(&utmp) == NULL)
+	{
+		F_("pututline failed\n");
+		endutent();
+		return;
+	}
 	endutent();
 	return;
-    }
-    endutent();
-    return;
 }
 
 static void initng_reload(void)
 {
-    s_command *reload = initng_command_find_by_command_id('c');
+	s_command *reload = initng_command_find_by_command_id('c');
 
-    if (reload && reload->u.void_command_call)
-    {
-	(*reload->u.void_command_call) (NULL);
-    }
+	if (reload && reload->u.void_command_call)
+	{
+		(*reload->u.void_command_call) (NULL);
+	}
 }
 
 
@@ -281,66 +281,66 @@
 /* try open FIFO, every started service */
 static void hup_request(int signal)
 {
-    /* Look for the right signal */
-    if (signal != SIGHUP)
-	return;
+	/* Look for the right signal */
+	if (signal != SIGHUP)
+		return;
 
-    if (!initctl_control_open())
-    {
-	F_("Warning, failed to open /dev/initctl\n");
-    }
+	if (!initctl_control_open())
+	{
+		F_("Warning, failed to open /dev/initctl\n");
+	}
 }
 
 static void is_system_up(h_sys_state state)
 {
-    if (state == STATE_UP && (!utmp_stored))
-    {
-	makeutmp(3);
-    }
+	if (state == STATE_UP && (!utmp_stored))
+	{
+		makeutmp(3);
+	}
 }
 
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    if (!g.i_am_init)
-    {
-	initng_unload_module_named("initctl");
-	return (TRUE);			    /* this is not a failure */
-    }
-
-    utmp_stored = FALSE;
-
-    initctl_control_open();
-
-    if ((!initng_plugin_hook_add(&g.SIGNAL, 50, &hup_request))
-	|| (!initng_plugin_hook_add(&g.SWATCHERS, 50, &is_system_up)))
-    {
-	F_("Fail add hook!\n");
-	return (FALSE);
-    }
-    return (TRUE);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	if (!g.i_am_init)
+	{
+		initng_unload_module_named("initctl");
+		return (TRUE);						/* this is not a failure */
+	}
+
+	utmp_stored = FALSE;
+
+	initctl_control_open();
+
+	if ((!initng_plugin_hook_add(&g.SIGNAL, 50, &hup_request))
+		|| (!initng_plugin_hook_add(&g.SWATCHERS, 50, &is_system_up)))
+	{
+		F_("Fail add hook!\n");
+		return (FALSE);
+	}
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    /* then this module was never loaded */
-    if (!g.i_am_init)
-	return;				    /* this is not a failure */
+	/* then this module was never loaded */
+	if (!g.i_am_init)
+		return;								/* this is not a failure */
 
 
-    initctl_control_close();
-    /* remove all hooks */
-    initng_plugin_hook_del(&g.FDWATCHERS, &pipe_fd);
-    initng_plugin_hook_del(&g.SWATCHERS, &is_system_up);
-    initng_plugin_hook_del(&g.SIGNAL, &hup_request);
+	initctl_control_close();
+	/* remove all hooks */
+	initng_plugin_hook_del(&g.FDWATCHERS, &pipe_fd);
+	initng_plugin_hook_del(&g.SWATCHERS, &is_system_up);
+	initng_plugin_hook_del(&g.SIGNAL, &hup_request);
 }

Modified: initng/trunk/plugins/initctl/initreq.h
==============================================================================
--- initng/trunk/plugins/initctl/initreq.h	(original)
+++ initng/trunk/plugins/initctl/initreq.h	Wed Apr  5 23:11:19 2006
@@ -46,14 +46,14 @@
  */
 struct init_request_bsd
 {
-    char gen_id[8];		/* Beats me.. telnetd uses "fe" */
-    char tty_id[16];		/* Tty name minus /dev/tty      */
-    char host[INITRQ_HLEN];	/* Hostname                     */
-    char term_type[16];		/* Terminal type                */
-    int signal;			/* Signal to send               */
-    int pid;			/* Process to send to           */
-    char exec_name[128];	/* Program to execute           */
-    char reserved[128];		/* For future expansion.        */
+	char gen_id[8];				/* Beats me.. telnetd uses "fe" */
+	char tty_id[16];			/* Tty name minus /dev/tty      */
+	char host[INITRQ_HLEN];		/* Hostname                     */
+	char term_type[16];			/* Terminal type                */
+	int signal;					/* Signal to send               */
+	int pid;					/* Process to send to           */
+	char exec_name[128];		/* Program to execute           */
+	char reserved[128];			/* For future expansion.        */
 };
 
 
@@ -66,15 +66,15 @@
  */
 struct init_request
 {
-    int magic;			/* Magic number                 */
-    int cmd;			/* What kind of request         */
-    int runlevel;		/* Runlevel to change to        */
-    int sleeptime;		/* Time between TERM and KILL   */
-    union
-    {
-	struct init_request_bsd bsd;
-	char data[368];
-    } i;
+	int magic;					/* Magic number                 */
+	int cmd;					/* What kind of request         */
+	int runlevel;				/* Runlevel to change to        */
+	int sleeptime;				/* Time between TERM and KILL   */
+	union
+	{
+		struct init_request_bsd bsd;
+		char data[368];
+	} i;
 };
 
 #endif

Modified: initng/trunk/plugins/interactive/initng_interactive.c
==============================================================================
--- initng/trunk/plugins/interactive/initng_interactive.c	(original)
+++ initng/trunk/plugins/interactive/initng_interactive.c	Wed Apr  5 23:11:19 2006
@@ -21,8 +21,8 @@
 
 
 #include <stdio.h>
-#include <string.h>			    /* strstr() */
-#include <stdlib.h>			    /* free() exit() */
+#include <string.h>							/* strstr() */
+#include <stdlib.h>							/* free() exit() */
 #include <initng_handler.h>
 #include <initng_global.h>
 #include <initng_plugin_hook.h>
@@ -39,94 +39,94 @@
 
 static int interactive_STARTING(active_db_h * service)
 {
-    char asw[10];
+	char asw[10];
 
-    asw[0] = '\0';
+	asw[0] = '\0';
 
-    fprintf(stderr, "Start service %s, (Y/n/a):", service->name);
-    /* HACK: ignore read errors by assuming 'n' */
-    if (fgets(asw, 9, stdin) == NULL)
-	asw[0] = 'n';
-
-    /* if it is true, then its ok to launch service */
-    if (asw[0] == 'y' || asw[0] == 'Y')
-	return (TRUE);
-
-    if (asw[0] == 'a' || asw[0] == 'A')
-    {
-	initng_plugin_hook_del(&g.START_DEP_MET, &interactive_STARTING);
-	initng_plugin_hook_del(&g.STOP_DEP_MET, &interactive_STOP_MARKED);
-	active = FALSE;
-	return (TRUE);
-    }
+	fprintf(stderr, "Start service %s, (Y/n/a):", service->name);
+	/* HACK: ignore read errors by assuming 'n' */
+	if (fgets(asw, 9, stdin) == NULL)
+		asw[0] = 'n';
+
+	/* if it is true, then its ok to launch service */
+	if (asw[0] == 'y' || asw[0] == 'Y')
+		return (TRUE);
+
+	if (asw[0] == 'a' || asw[0] == 'A')
+	{
+		initng_plugin_hook_del(&g.START_DEP_MET, &interactive_STARTING);
+		initng_plugin_hook_del(&g.STOP_DEP_MET, &interactive_STOP_MARKED);
+		active = FALSE;
+		return (TRUE);
+	}
 
-    initng_common_mark_service(service, &INT_DISABLED);
-    return (FAIL);
+	initng_common_mark_service(service, &INT_DISABLED);
+	return (FAIL);
 }
 
 static int interactive_STOP_MARKED(active_db_h * service)
 {
-    char asw[10];
-
-    asw[0] = '\0';
+	char asw[10];
 
-    fprintf(stderr, "Stop service %s, (Y/n/a):", service->name);
-    /* HACK: ignore read errors by assuming 'n' */
-    if (fgets(asw, 9, stdin) == NULL)
-	asw[0] = 'n';
-
-    if (asw[0] == 'y' || asw[0] == 'Y')
-	return (TRUE);
+	asw[0] = '\0';
 
-    if (asw[0] == 'a' || asw[0] == 'A')
-    {
-	initng_plugin_hook_del(&g.START_DEP_MET, &interactive_STARTING);
-	initng_plugin_hook_del(&g.STOP_DEP_MET, &interactive_STOP_MARKED);
-	active = FALSE;
-	return (TRUE);
-    }
+	fprintf(stderr, "Stop service %s, (Y/n/a):", service->name);
+	/* HACK: ignore read errors by assuming 'n' */
+	if (fgets(asw, 9, stdin) == NULL)
+		asw[0] = 'n';
+
+	if (asw[0] == 'y' || asw[0] == 'Y')
+		return (TRUE);
+
+	if (asw[0] == 'a' || asw[0] == 'A')
+	{
+		initng_plugin_hook_del(&g.START_DEP_MET, &interactive_STARTING);
+		initng_plugin_hook_del(&g.STOP_DEP_MET, &interactive_STOP_MARKED);
+		active = FALSE;
+		return (TRUE);
+	}
 
-    initng_common_mark_service(service, &INT_DISABLED);
-    return (FAIL);
+	initng_common_mark_service(service, &INT_DISABLED);
+	return (FAIL);
 }
 
 int module_init(int api_version)
 {
-    int i;
+	int i;
 
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    D_("module_init();\n");
-
-    /* look for the string interactive */
-    for (i = 0; g.Argv[i]; i++)
-	if (strstr(g.Argv[i], "interactive"))
-	{				    /* if found */
-
-	    P_("Initng is started in interactive mode!\n");
-	    initng_plugin_hook_add(&g.START_DEP_MET, 90,
-				   &interactive_STARTING);
-	    initng_plugin_hook_add(&g.STOP_DEP_MET, 90,
-				   &interactive_STOP_MARKED);
-	    active = TRUE;
-	    return (TRUE);
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
 	}
 
-    active = FALSE;
-    initng_unload_module_named("interactive");
-    return (TRUE);
+	D_("module_init();\n");
+
+	/* look for the string interactive */
+	for (i = 0; g.Argv[i]; i++)
+		if (strstr(g.Argv[i], "interactive"))
+		{									/* if found */
+
+			P_("Initng is started in interactive mode!\n");
+			initng_plugin_hook_add(&g.START_DEP_MET, 90,
+								   &interactive_STARTING);
+			initng_plugin_hook_add(&g.STOP_DEP_MET, 90,
+								   &interactive_STOP_MARKED);
+			active = TRUE;
+			return (TRUE);
+		}
+
+	active = FALSE;
+	initng_unload_module_named("interactive");
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    if (active == TRUE)
-    {
-	initng_plugin_hook_del(&g.START_DEP_MET, &interactive_STARTING);
-	initng_plugin_hook_del(&g.STOP_DEP_MET, &interactive_STOP_MARKED);
-    }
+	D_("module_unload();\n");
+	if (active == TRUE)
+	{
+		initng_plugin_hook_del(&g.START_DEP_MET, &interactive_STARTING);
+		initng_plugin_hook_del(&g.STOP_DEP_MET, &interactive_STOP_MARKED);
+	}
 }

Modified: initng/trunk/plugins/iparser/initng_i_parser.c
==============================================================================
--- initng/trunk/plugins/iparser/initng_i_parser.c	(original)
+++ initng/trunk/plugins/iparser/initng_i_parser.c	Wed Apr  5 23:11:19 2006
@@ -43,7 +43,7 @@
 
 #define ENDED(x) (!(x)[0] || (x)[0]=='\n')
 char *g_filename = NULL;
-char *g_pointer = NULL;		/* a pointer to the first char we can back step to when printing line copies */
+char *g_pointer = NULL;			/* a pointer to the first char we can back step to when printing line copies */
 
 
 /* set this to have a really verbose walking output */
@@ -53,23 +53,23 @@
 #define FL_(a,m) err_print_line2t(a, m, MSG_FAIL, __FILE__, (const char*)__PRETTY_FUNCTION__, __LINE__)
 
 static void err_print_line2t(char *point, const char *message, e_mt err,
-			     const char *file, const char *func,
-			     int codeline);
+							 const char *file, const char *func,
+							 int codeline);
 static service_cache_h *parse_file(char *filename, const char *watch_for);
 static int parse_service_line(char **to_parse, const char *watch_for,
-			      service_cache_h * father, stype_h * type,
-			      char *filename, service_cache_h ** match,
-			      service_cache_h ** exact_match);
+							  service_cache_h * father, stype_h * type,
+							  char *filename, service_cache_h ** match,
+							  service_cache_h ** exact_match);
 static int parse_opt(char **where, stype_h * type, service_cache_h * srv);
 
 static int set_parser(s_entry * type, char **value, char *va,
-		      service_cache_h * from_service);
+					  service_cache_h * from_service);
 static int string_parser(s_entry * type, char **value, char *va,
-			 service_cache_h * from_service);
+						 service_cache_h * from_service);
 static int strings_parser(s_entry * type, char **value, char *va,
-			  service_cache_h * from_service);
+						  service_cache_h * from_service);
 static int iint_parser(s_entry * type, char **value, char *va,
-		       service_cache_h * from_service);
+					   service_cache_h * from_service);
 
 static char *dup_string_and_walk(char **value, int break_on_space);
 
@@ -77,64 +77,64 @@
 
 static int is_valid(char *string)
 {
-    int i;
+	int i;
 
-    for (i = 0; string[i] != 0; i++)
-	if (string[i] <= 32)
-	    return (FALSE);
+	for (i = 0; string[i] != 0; i++)
+		if (string[i] <= 32)
+			return (FALSE);
 
-    return (TRUE);
+	return (TRUE);
 }
 
 static void err_print_line2t(char *point, const char *message, e_mt err,
-			     const char *file, const char *func, int codeline)
+							 const char *file, const char *func, int codeline)
 {
-    char *line;
-    char *pstr;
-    int len = 0;
-    int i = 0;
-    int pi = 0;
-    char *start = point;
-
-    /* make sure global filename is set */
-    if (!g_pointer || !g_filename)
-	return;
-
-    /*while(start != g_pointer && start[-1] != g_pointer && start[-1] != '\n') */
-    while (start != g_pointer && (start - 1)[0] != '\n')
-	start--;
-
-    while (start[len] && start[len] != '\n')
-	len++;
-
-    pi = point - start;
-
-    /* copy line working on */
-    line = i_strndup(start, len);
-    pstr = i_calloc(pi + 4, sizeof(char));
-    if (!line || !pstr)
-	return;
-
-    /* put spaces */
-    memset(pstr, ' ', sizeof(char) * (pi));
-
-    /* Tabs destroy our position pointers, replaces with spaces */
-    for (i = 0; line[i]; i++)
-	if (line[i] == '\t')
-	    line[i] = ' ';
-
-
-    /* then, put the marker. */
-    pstr[pi] = '^';
-    pstr[pi + 1] = '\0';
-
-
-    initng_error_print(err, file, func, codeline,
-		       "%s\nfile: %s\n\"%s\"\n %s\n\n", message,
-		       g_filename, line, pstr);
-    free(line);
-    free(pstr);
-    sleep(0.2);
+	char *line;
+	char *pstr;
+	int len = 0;
+	int i = 0;
+	int pi = 0;
+	char *start = point;
+
+	/* make sure global filename is set */
+	if (!g_pointer || !g_filename)
+		return;
+
+	/*while(start != g_pointer && start[-1] != g_pointer && start[-1] != '\n') */
+	while (start != g_pointer && (start - 1)[0] != '\n')
+		start--;
+
+	while (start[len] && start[len] != '\n')
+		len++;
+
+	pi = point - start;
+
+	/* copy line working on */
+	line = i_strndup(start, len);
+	pstr = i_calloc(pi + 4, sizeof(char));
+	if (!line || !pstr)
+		return;
+
+	/* put spaces */
+	memset(pstr, ' ', sizeof(char) * (pi));
+
+	/* Tabs destroy our position pointers, replaces with spaces */
+	for (i = 0; line[i]; i++)
+		if (line[i] == '\t')
+			line[i] = ' ';
+
+
+	/* then, put the marker. */
+	pstr[pi] = '^';
+	pstr[pi + 1] = '\0';
+
+
+	initng_error_print(err, file, func, codeline,
+					   "%s\nfile: %s\n\"%s\"\n %s\n\n", message,
+					   g_filename, line, pstr);
+	free(line);
+	free(pstr);
+	sleep(0.2);
 }
 
 
@@ -142,568 +142,568 @@
 /* Load a service from a service_to_find or process_path */
 static service_cache_h *initng_i_parser(const char *service_to_find)
 {
-    char filetoparse[200];
-    service_cache_h *got_serv = NULL;
-    char *path = NULL;
-    const char *service = NULL;
-
-    assert(service_to_find);
-
-    /* Make sure the filename of 200 chars above are more than enough */
-    if (strlen(service_to_find) > 50)
-    {
-	F_("Service name to long, initng_i_parser can't look for this service!\n");
-	return (NULL);
-    }
+	char filetoparse[200];
+	service_cache_h *got_serv = NULL;
+	char *path = NULL;
+	const char *service = NULL;
 
-    /*
-     * now set up path and service.
-     * if service_to_find is system/initial/udevd
-     * path should be "system/initial"
-     * and service "udevd"
-     */
-
-    /* set up a patch copy, has to be free() */
-    path = st_get_path(service_to_find);
-
-    /* this is a pointer to a entry in service_to_find */
-    service = st_strip_path(service_to_find);
-
-    D_("initng_i_parser(%s);\n", service_to_find);
-    /* example  INITNG_ROOT=/etc/initng service_to_find="daemon/sshd INITNG_EXT=".i" */
-    /* TRY NO 1, try load   "/etc/initng/daemon/sshd.i" */
-    /* TRY NO 2, try load   "/etc/initng/daemon/sshd/sshd.i" */
-    /* TRY NO 3, try load   "/etc/initng/daemon/sshd/default.i" */
-    /* TRY NO 4, try load   "/etc/initng/daemon/default.i" */
-    /* TRY NO 5, try load   "/etc/initng/daemon/daemon.i */
-    /* TRY NO 6, try load   "/etc/initng/sshd.i" */
-    /* TRY NO 7, try load   "/etc/initng/daemon.i */
-
-    /* TRY NO 1, try load   "/etc/initng/daemon/sshd/sshd.i" */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, service_to_find);
-    strcat(filetoparse, "/");
-    strcat(filetoparse, service);
-    strcat(filetoparse, INITNG_EXT);
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    /* TRY NO 2, try load   "/etc/initng/daemon/sshd.i" */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, service_to_find);
-    strcat(filetoparse, INITNG_EXT);
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    /* TRY NO 3, try load   "/etc/initng/daemon/sshd/default.i" */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, service_to_find);
-    strcat(filetoparse, "/default" INITNG_EXT);
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    /* TRY NO 4, try "/etc/initng/daemon/default.i" */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, path);
-    strcat(filetoparse, "/default" INITNG_EXT);
+	assert(service_to_find);
 
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, path);
-    strcat(filetoparse, "/");
-    strcat(filetoparse, path);
-    strcat(filetoparse, INITNG_EXT);
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    /* TRY NO 6, try "/etc/initng/sshd.i" */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, service);
-    strcat(filetoparse, INITNG_EXT);
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    /* TRY NO 7, try "/etc/initng/daemon.i" */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, path);
-    strcat(filetoparse, INITNG_EXT);
-    if ((got_serv = parse_file(filetoparse, service_to_find)))
-    {
-	free(path);
-	return (got_serv);
-    }
-    filetoparse[0] = '\0';
-
-    D_("Was not able to parse: %s\n", service_to_find);
-    free(path);
-    return (NULL);
-}
+	/* Make sure the filename of 200 chars above are more than enough */
+	if (strlen(service_to_find) > 50)
+	{
+		F_("Service name to long, initng_i_parser can't look for this service!\n");
+		return (NULL);
+	}
 
-/* parse a file for services */
-static service_cache_h *parse_file(char *filename, const char *watch_for)
-{
-    /* Pointer to content read, and pointer to where we are reading */
-    char *file_content = NULL;
-    char *file = NULL;
+	/*
+	 * now set up path and service.
+	 * if service_to_find is system/initial/udevd
+	 * path should be "system/initial"
+	 * and service "udevd"
+	 */
 
+	/* set up a patch copy, has to be free() */
+	path = st_get_path(service_to_find);
 
-    /* if service is matching, it is set, if service is exact_match this is set */
-    service_cache_h *match = NULL;
-    service_cache_h *exact_match = NULL;
+	/* this is a pointer to a entry in service_to_find */
+	service = st_strip_path(service_to_find);
 
-    /* standard assertions */
-    assert(filename);
-    assert(watch_for);
+	D_("initng_i_parser(%s);\n", service_to_find);
+	/* example  INITNG_ROOT=/etc/initng service_to_find="daemon/sshd INITNG_EXT=".i" */
+	/* TRY NO 1, try load   "/etc/initng/daemon/sshd.i" */
+	/* TRY NO 2, try load   "/etc/initng/daemon/sshd/sshd.i" */
+	/* TRY NO 3, try load   "/etc/initng/daemon/sshd/default.i" */
+	/* TRY NO 4, try load   "/etc/initng/daemon/default.i" */
+	/* TRY NO 5, try load   "/etc/initng/daemon/daemon.i */
+	/* TRY NO 6, try load   "/etc/initng/sshd.i" */
+	/* TRY NO 7, try load   "/etc/initng/daemon.i */
 
-    /* set the error message filename */
-    g_filename = filename;
+	/* TRY NO 1, try load   "/etc/initng/daemon/sshd/sshd.i" */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, service_to_find);
+	strcat(filetoparse, "/");
+	strcat(filetoparse, service);
+	strcat(filetoparse, INITNG_EXT);
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
+	{
+		free(path);
+		return (got_serv);
+	}
+	filetoparse[0] = '\0';
 
-    D_("parse_file(%s);\n", filename);
+	/* TRY NO 2, try load   "/etc/initng/daemon/sshd.i" */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, service_to_find);
+	strcat(filetoparse, INITNG_EXT);
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
+	{
+		free(path);
+		return (got_serv);
+	}
+	filetoparse[0] = '\0';
 
-    /* read config file */
-    if (!open_read_close(filename, &file_content))
-    {
-	D_("Can't open config file %s.\n", filename);
-	return (NULL);
-    }
-    file = file_content;
-    g_pointer = file;
+	/* TRY NO 3, try load   "/etc/initng/daemon/sshd/default.i" */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, service_to_find);
+	strcat(filetoparse, "/default" INITNG_EXT);
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
+	{
+		free(path);
+		return (got_serv);
+	}
+	filetoparse[0] = '\0';
 
+	/* TRY NO 4, try "/etc/initng/daemon/default.i" */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, path);
+	strcat(filetoparse, "/default" INITNG_EXT);
 
-    /* main parse line by line loop */
-    while (file[0] != '\0')
-    {
-	stype_h *stype = NULL;
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
+	{
+		free(path);
+		return (got_serv);
+	}
+	filetoparse[0] = '\0';
 
-	DL_(file, "parse_file while loop:");
-	/* skip leading spaces */
-	JUMP_NSPACES(file);
-	if (file[0] == '\0')
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, path);
+	strcat(filetoparse, "/");
+	strcat(filetoparse, path);
+	strcat(filetoparse, INITNG_EXT);
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
 	{
-	    DL_(file, "End of file");
-	    break;
+		free(path);
+		return (got_serv);
 	}
+	filetoparse[0] = '\0';
 
-	/* skip lines starting with '#' */
-	if (file[0] == '#' || file[0] == '\n' || file[0] == ';')
+	/* TRY NO 6, try "/etc/initng/sshd.i" */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, service);
+	strcat(filetoparse, INITNG_EXT);
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
 	{
-	    REALLY_JUMP_TO_NEXT_ROW(file);
-	    continue;
+		free(path);
+		return (got_serv);
 	}
-	/*
-	 * parsometer:
-	 *   service test {
-	 *   ^
-	 */
+	filetoparse[0] = '\0';
 
-	/* get the stype */
-	if (!(stype = initng_service_types_get(file)))
+	/* TRY NO 7, try "/etc/initng/daemon.i" */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, path);
+	strcat(filetoparse, INITNG_EXT);
+	if ((got_serv = parse_file(filetoparse, service_to_find)))
 	{
-	    match = NULL;
-	    break;
+		free(path);
+		return (got_serv);
 	}
+	filetoparse[0] = '\0';
 
-	JUMP_TO_NEXT_WORD(file);
-	/*
-	 * parsometer:
-	 *   service test {
-	 *           ^
-	 */
+	D_("Was not able to parse: %s\n", service_to_find);
+	free(path);
+	return (NULL);
+}
 
-	/* parse line, with options from that service type */
-	if (parse_service_line(&file, watch_for, NULL, stype,
-			       filename, &match, &exact_match) == TRUE)
-	{
-	    /* if we found RIGHT what we wanted */
-	    if (exact_match)
-	    {
-		match = exact_match;
-		break;
-	    }
-
-	    /* ok, jump the ending '}' stack */
-	    if (file[0] == '}')
-		file++;
-	}
-
-    }					    /* end while */
-
-    if (file_content)
-    {
-	free(file_content);
-	file_content = NULL;
-    }
-
-    /* add to service db */
-    if (match && !initng_service_cache_add(match))
-    {
-	/* Problem adding, probably this service name exists already,
-	 * DO NOT EVEN TRY TO UNLOAD EXISTENT! some services my already rely on it or 
-	 * we can get here if we processing 'need' option from this service, unloading
-	 * will make watch_for to point on not existing area of memory!
-	 */
-	service_cache_h *found;
+/* parse a file for services */
+static service_cache_h *parse_file(char *filename, const char *watch_for)
+{
+	/* Pointer to content read, and pointer to where we are reading */
+	char *file_content = NULL;
+	char *file = NULL;
+
+
+	/* if service is matching, it is set, if service is exact_match this is set */
+	service_cache_h *match = NULL;
+	service_cache_h *exact_match = NULL;
+
+	/* standard assertions */
+	assert(filename);
+	assert(watch_for);
+
+	/* set the error message filename */
+	g_filename = filename;
+
+	D_("parse_file(%s);\n", filename);
+
+	/* read config file */
+	if (!open_read_close(filename, &file_content))
+	{
+		D_("Can't open config file %s.\n", filename);
+		return (NULL);
+	}
+	file = file_content;
+	g_pointer = file;
+
+
+	/* main parse line by line loop */
+	while (file[0] != '\0')
+	{
+		stype_h *stype = NULL;
+
+		DL_(file, "parse_file while loop:");
+		/* skip leading spaces */
+		JUMP_NSPACES(file);
+		if (file[0] == '\0')
+		{
+			DL_(file, "End of file");
+			break;
+		}
+
+		/* skip lines starting with '#' */
+		if (file[0] == '#' || file[0] == '\n' || file[0] == ';')
+		{
+			REALLY_JUMP_TO_NEXT_ROW(file);
+			continue;
+		}
+		/*
+		 * parsometer:
+		 *   service test {
+		 *   ^
+		 */
+
+		/* get the stype */
+		if (!(stype = initng_service_types_get(file)))
+		{
+			match = NULL;
+			break;
+		}
 
-	/* search for an with same name */
-	found = initng_service_cache_find_by_name(match->name);
+		JUMP_TO_NEXT_WORD(file);
+		/*
+		 * parsometer:
+		 *   service test {
+		 *           ^
+		 */
+
+		/* parse line, with options from that service type */
+		if (parse_service_line(&file, watch_for, NULL, stype,
+							   filename, &match, &exact_match) == TRUE)
+		{
+			/* if we found RIGHT what we wanted */
+			if (exact_match)
+			{
+				match = exact_match;
+				break;
+			}
+
+			/* ok, jump the ending '}' stack */
+			if (file[0] == '}')
+				file++;
+		}
 
-	/* if found, free created an return founded */
-	if (found)
+	}										/* end while */
+
+	if (file_content)
 	{
-	    initng_service_cache_free(match);
-	    match = found;
+		free(file_content);
+		file_content = NULL;
 	}
-	else if (!initng_service_cache_add(match))
+
+	/* add to service db */
+	if (match && !initng_service_cache_add(match))
 	{
-	    F_("Could not add service to service db!\n");
-	    initng_service_cache_free(match);
-	    match = NULL;
+		/* Problem adding, probably this service name exists already,
+		 * DO NOT EVEN TRY TO UNLOAD EXISTENT! some services my already rely on it or 
+		 * we can get here if we processing 'need' option from this service, unloading
+		 * will make watch_for to point on not existing area of memory!
+		 */
+		service_cache_h *found;
+
+		/* search for an with same name */
+		found = initng_service_cache_find_by_name(match->name);
+
+		/* if found, free created an return founded */
+		if (found)
+		{
+			initng_service_cache_free(match);
+			match = found;
+		}
+		else if (!initng_service_cache_add(match))
+		{
+			F_("Could not add service to service db!\n");
+			initng_service_cache_free(match);
+			match = NULL;
+		}
 	}
-    }
 
 #ifdef DEBUG
-    if (!match)
-	D_("%s - no match", watch_for);
+	if (!match)
+		D_("%s - no match", watch_for);
 #endif
 
-    /* Return what we got, and hope for the best */
-    return (match);
+	/* Return what we got, and hope for the best */
+	return (match);
 }
 
 
 static int parse_service_line(char **to_parse, const char *watch_for,
-			      service_cache_h * father, stype_h * type,
-			      char *filename, service_cache_h ** match,
-			      service_cache_h ** exact_match)
+							  service_cache_h * father, stype_h * type,
+							  char *filename, service_cache_h ** match,
+							  service_cache_h ** exact_match)
 {
-    char *name = NULL;
-    char *father_name = NULL;
-    service_cache_h *new_service = NULL;
+	char *name = NULL;
+	char *father_name = NULL;
+	service_cache_h *new_service = NULL;
 
 #ifdef SUB_CLASS
-    service_cache_h *duplicate = NULL;
-    int len;
+	service_cache_h *duplicate = NULL;
+	int len;
 #endif
 
-    assert(to_parse);
-    assert(*to_parse);
-    assert(watch_for);
-
-    /* for debugging */
-    DL_(*to_parse, "parse_service_line:");
-
-    /* service test : class { */
-    /*        |               */
-    /* jump forward on spaces */
-    JUMP_NSPACES(*to_parse);
-    if (ENDED(*to_parse))
-    {
-	FL_(*to_parse, "Line ended unexpectedly.");
-	return (FALSE);
-    }
-
-    /* service test : class { */
-    /*         |              */
+	assert(to_parse);
+	assert(*to_parse);
+	assert(watch_for);
 
-    /* this fetches name, and increase *to_parse */
-    if (!(name = st_dup_next_word(to_parse)))
-    {
-	FL_(*to_parse, "Did not get a name!");
-	return (FALSE);
-    }
-
-    if (!is_valid(name))
-    {
-	FL_(*to_parse, "Name contains invalid characters.");
-	return (FALSE);
-    }
-
-    /* service test : class { */
-    /*             |          */
-
-    D_("parse_service_line(s,%s): service name: \"%s\"\n", watch_for, name);
-
-    /* jump forward on spaces */
-    JUMP_NSPACES(*to_parse);
-    if (ENDED(*to_parse))
-    {
-	FL_(*to_parse, "Line ended unexpectedly.");
-	free(name);
-	return (FALSE);;
-    }
+	/* for debugging */
+	DL_(*to_parse, "parse_service_line:");
 
-    /* service test : class { */
-    /*              |         */
-    if ((*to_parse)[0] == ':')
-    {
-	(*to_parse)++;
 	/* service test : class { */
-	/*               |        */
-
+	/*        |               */
 	/* jump forward on spaces */
 	JUMP_NSPACES(*to_parse);
 	if (ENDED(*to_parse))
 	{
-	    FL_(*to_parse, "Line ended unexpectedly.");
-	    free(name);
-	    return (FALSE);
+		FL_(*to_parse, "Line ended unexpectedly.");
+		return (FALSE);
 	}
+
 	/* service test : class { */
-	/*                |       */
+	/*         |              */
 
-	if (!(father_name = st_dup_next_word(to_parse)))
+	/* this fetches name, and increase *to_parse */
+	if (!(name = st_dup_next_word(to_parse)))
 	{
-	    FL_(*to_parse, "Unable to fetch fathername.");
-	    free(name);
-	    return (FALSE);
+		FL_(*to_parse, "Did not get a name!");
+		return (FALSE);
 	}
 
-	if (!is_valid(father_name))
+	if (!is_valid(name))
 	{
-	    FL_(*to_parse, "Father name contains invalid characters.");
-	    return (FALSE);
+		FL_(*to_parse, "Name contains invalid characters.");
+		return (FALSE);
 	}
 
-#ifdef DEBUG
-	if (father_name)
-	    D_("Father is: %s, set from \"server : father\"\n", father_name);
-#endif
-
 	/* service test : class { */
-	/*                     |  */
+	/*             |          */
+
+	D_("parse_service_line(s,%s): service name: \"%s\"\n", watch_for, name);
+
 	/* jump forward on spaces */
 	JUMP_NSPACES(*to_parse);
 	if (ENDED(*to_parse))
 	{
-	    FL_(*to_parse, "Line ended unexpectedly.");
-	    free(name);
-	    free(father_name);
-	    return (FALSE);
-	}
-    }
-
-    DL_(*to_parse, "Parse opt, should stand directly over { char");
-    /* service test : class { */
-    /*                      | */
-    if ((*to_parse)[0] != '{')
-    {
-	/* something is wrong */
-	FL_(*to_parse, "error parsing, expected something else.");
-	free(name);
-	if (father_name)
-	    free(father_name);
-	return (FALSE);
-    }
-
-    /* jump to first char after start tag and begin from there. */
-    (*to_parse)++;
-    JUMP_NSPACES(*to_parse);
-
-    if (initng_service_cache_find_by_exact_name(name))
-    {
-	D_("service %s already parsed, skipping to the end of stack\n", name);
-	int stack = 1;
-	int quoted = FALSE;
-	int backslashed = FALSE;
+		FL_(*to_parse, "Line ended unexpectedly.");
+		free(name);
+		return (FALSE);;
+	}
 
-	while ((*to_parse)[0])
+	/* service test : class { */
+	/*              |         */
+	if ((*to_parse)[0] == ':')
 	{
-	    if (backslashed == FALSE)
-	    {
-		if ((*to_parse)[0] == '\\')
-		    backslashed = TRUE;
-		else if ((*to_parse)[0] == '"' || (*to_parse)[0] == '\'')
-		{
-		    if (quoted == FALSE)
-			quoted = (*to_parse)[0];
-		    else if (quoted == (*to_parse)[0])
-			quoted = FALSE;
-		}
-		else if (quoted == FALSE)
-		{
-		    if ((*to_parse)[0] == '{')
-			stack++;
-		    else if ((*to_parse)[0] == '}')
-			stack--;
-		    else if ((*to_parse)[0] == '#')
-		    {
-			REALLY_JUMP_TO_NEXT_ROW(*to_parse);
-			continue;
-		    }
+		(*to_parse)++;
+		/* service test : class { */
+		/*               |        */
+
+		/* jump forward on spaces */
+		JUMP_NSPACES(*to_parse);
+		if (ENDED(*to_parse))
+		{
+			FL_(*to_parse, "Line ended unexpectedly.");
+			free(name);
+			return (FALSE);
+		}
+		/* service test : class { */
+		/*                |       */
+
+		if (!(father_name = st_dup_next_word(to_parse)))
+		{
+			FL_(*to_parse, "Unable to fetch fathername.");
+			free(name);
+			return (FALSE);
 		}
-	    }
-	    else
-		backslashed = FALSE;
 
-	    if (stack == 0)
-		break;
+		if (!is_valid(father_name))
+		{
+			FL_(*to_parse, "Father name contains invalid characters.");
+			return (FALSE);
+		}
 
-	    (*to_parse)++;
+#ifdef DEBUG
+		if (father_name)
+			D_("Father is: %s, set from \"server : father\"\n", father_name);
+#endif
+
+		/* service test : class { */
+		/*                     |  */
+		/* jump forward on spaces */
+		JUMP_NSPACES(*to_parse);
+		if (ENDED(*to_parse))
+		{
+			FL_(*to_parse, "Line ended unexpectedly.");
+			free(name);
+			free(father_name);
+			return (FALSE);
+		}
 	}
 
-	free(name);
-	if (father_name)
-	    free(father_name);
+	DL_(*to_parse, "Parse opt, should stand directly over { char");
+	/* service test : class { */
+	/*                      | */
+	if ((*to_parse)[0] != '{')
+	{
+		/* something is wrong */
+		FL_(*to_parse, "error parsing, expected something else.");
+		free(name);
+		if (father_name)
+			free(father_name);
+		return (FALSE);
+	}
 
-	return (TRUE);
-    }
+	/* jump to first char after start tag and begin from there. */
+	(*to_parse)++;
+	JUMP_NSPACES(*to_parse);
 
-    DL_(*to_parse, "Parse opt, should be first char in stack");
+	if (initng_service_cache_find_by_exact_name(name))
+	{
+		D_("service %s already parsed, skipping to the end of stack\n", name);
+		int stack = 1;
+		int quoted = FALSE;
+		int backslashed = FALSE;
 
+		while ((*to_parse)[0])
+		{
+			if (backslashed == FALSE)
+			{
+				if ((*to_parse)[0] == '\\')
+					backslashed = TRUE;
+				else if ((*to_parse)[0] == '"' || (*to_parse)[0] == '\'')
+				{
+					if (quoted == FALSE)
+						quoted = (*to_parse)[0];
+					else if (quoted == (*to_parse)[0])
+						quoted = FALSE;
+				}
+				else if (quoted == FALSE)
+				{
+					if ((*to_parse)[0] == '{')
+						stack++;
+					else if ((*to_parse)[0] == '}')
+						stack--;
+					else if ((*to_parse)[0] == '#')
+					{
+						REALLY_JUMP_TO_NEXT_ROW(*to_parse);
+						continue;
+					}
+				}
+			}
+			else
+				backslashed = FALSE;
 
-    /* service test : class { */
-    /*                       | */
+			if (stack == 0)
+				break;
 
-    new_service = initng_service_cache_new(name, type);
+			(*to_parse)++;
+		}
 
-    /* from here, don't use name anymore, use new_service->name */
-    free(name);
-    name = NULL;
+		free(name);
+		if (father_name)
+			free(father_name);
 
-    /* FROM NOW, we should not free name or father_name, because its ADDED, and required */
+		return (TRUE);
+	}
 
-    /* check so that it was allocated! */
-    if (!new_service)
-    {
-	F_("Unable to allocate space for new service.\n");
-	FL_(*to_parse, "Unable to allocate space for new service.");
-	if (father_name)
-	    free(father_name);
-	return (FALSE);
-    }
+	DL_(*to_parse, "Parse opt, should be first char in stack");
 
-    /* set the father to the service */
-    if (father_name)
-    {
-	if (father)
-	    new_service->father = father;
-	new_service->father_name = father_name;
-    }
 
-    /* set type if not set. */
-    if (father)
-	new_service->type = type;
+	/* service test : class { */
+	/*                       | */
 
-    /* carry on until segment stop or eof, this will handle all lines in current section */
-    while ((*to_parse)[0])
-    {
+	new_service = initng_service_cache_new(name, type);
 
-	DL_(*to_parse, "parse_service_line, while loop :");
+	/* from here, don't use name anymore, use new_service->name */
+	free(name);
+	name = NULL;
 
-	/* skip spaces and empty lines with them */
-	JUMP_NSPACES(*to_parse);
+	/* FROM NOW, we should not free name or father_name, because its ADDED, and required */
 
-	/* end of row */
-	if ((*to_parse)[0] == ';')
+	/* check so that it was allocated! */
+	if (!new_service)
 	{
-	    (*to_parse)++;
-	    continue;
+		F_("Unable to allocate space for new service.\n");
+		FL_(*to_parse, "Unable to allocate space for new service.");
+		if (father_name)
+			free(father_name);
+		return (FALSE);
 	}
 
-	/* end of file or stack */
-	if (!(*to_parse)[0] || (*to_parse)[0] == '}')
+	/* set the father to the service */
+	if (father_name)
 	{
-	    DL_(*to_parse,
-		"When escaping from parse_service_line while loop");
-	    break;
+		if (father)
+			new_service->father = father;
+		new_service->father_name = father_name;
 	}
 
-	/* skip lines starting with '#' */
-	if ((*to_parse)[0] == '#')
+	/* set type if not set. */
+	if (father)
+		new_service->type = type;
+
+	/* carry on until segment stop or eof, this will handle all lines in current section */
+	while ((*to_parse)[0])
 	{
-	    REALLY_JUMP_TO_NEXT_ROW(*to_parse);
-	    continue;
-	}
 
+		DL_(*to_parse, "parse_service_line, while loop :");
 
-	DL_(*to_parse, "parse_service_line, on first option char:");
+		/* skip spaces and empty lines with them */
+		JUMP_NSPACES(*to_parse);
 
-	/* parse line - search for keywords in g.option_table */
-	if (parse_opt(to_parse, type, new_service))
-	{
-	    if ((*to_parse)[0] != ';')
-	    {
-		FL_(*to_parse, "Must be a ';' char here");
-		break;
-	    }
+		/* end of row */
+		if ((*to_parse)[0] == ';')
+		{
+			(*to_parse)++;
+			continue;
+		}
 
-	    /* jump the ';' char */
-	    (*to_parse)++;
-	    continue;
-	}
+		/* end of file or stack */
+		if (!(*to_parse)[0] || (*to_parse)[0] == '}')
+		{
+			DL_(*to_parse,
+				"When escaping from parse_service_line while loop");
+			break;
+		}
 
-	/* Bad content, could not be parsed */
-	/* free and reset */
-	initng_service_cache_free(new_service);
-	new_service = NULL;
-	return (FALSE);
-    }
+		/* skip lines starting with '#' */
+		if ((*to_parse)[0] == '#')
+		{
+			REALLY_JUMP_TO_NEXT_ROW(*to_parse);
+			continue;
+		}
 
-    set_string(&FROM_FILE, new_service, i_strdup(filename));
 
+		DL_(*to_parse, "parse_service_line, on first option char:");
 
-    if (strcmp(new_service->name, watch_for) == 0)
-    {
-	D_("Found EXACT match: %s\n", new_service->name);
-	(*exact_match) = new_service;
-	return (TRUE);
-    }
+		/* parse line - search for keywords in g.option_table */
+		if (parse_opt(to_parse, type, new_service))
+		{
+			if ((*to_parse)[0] != ';')
+			{
+				FL_(*to_parse, "Must be a ';' char here");
+				break;
+			}
 
-    /* check if this is the service we are looking for. */
-    if (service_match(watch_for, new_service->name) == TRUE)
-    {
-	D_("Found :%s\n", new_service->name);
-
-	/* Just explanation - will erase later (TheLich):
-	 * don't keep services with wildcards in service_cache
-	 * thus there is each separate copy for each service, that
-	 * was created from wildcard service and now all services
-	 * in service cache will have unique names (no need in
-	 * pattern search when looking for service). This is because
-	 * of new behaviour of initng parser (adding to cache only that
-	 * service which was asked). If we will not do that, then if 
-	 * wildcard service exists in database and we want to add *real*
-	 * service, which matches this wildcard - it will not be added,
-	 * wildcard service will be used instead. (daemon/getty/ * and
-	 * daemon/getty/1 is a good example).
-	 */
+			/* jump the ';' char */
+			(*to_parse)++;
+			continue;
+		}
 
-	free(new_service->name);
-	new_service->name = i_strdup(watch_for);
-	(*match) = new_service;
-	return (TRUE);
-    }
+		/* Bad content, could not be parsed */
+		/* free and reset */
+		initng_service_cache_free(new_service);
+		new_service = NULL;
+		return (FALSE);
+	}
+
+	set_string(&FROM_FILE, new_service, i_strdup(filename));
+
+
+	if (strcmp(new_service->name, watch_for) == 0)
+	{
+		D_("Found EXACT match: %s\n", new_service->name);
+		(*exact_match) = new_service;
+		return (TRUE);
+	}
+
+	/* check if this is the service we are looking for. */
+	if (service_match(watch_for, new_service->name) == TRUE)
+	{
+		D_("Found :%s\n", new_service->name);
+
+		/* Just explanation - will erase later (TheLich):
+		 * don't keep services with wildcards in service_cache
+		 * thus there is each separate copy for each service, that
+		 * was created from wildcard service and now all services
+		 * in service cache will have unique names (no need in
+		 * pattern search when looking for service). This is because
+		 * of new behaviour of initng parser (adding to cache only that
+		 * service which was asked). If we will not do that, then if 
+		 * wildcard service exists in database and we want to add *real*
+		 * service, which matches this wildcard - it will not be added,
+		 * wildcard service will be used instead. (daemon/getty/ * and
+		 * daemon/getty/1 is a good example).
+		 */
+
+		free(new_service->name);
+		new_service->name = i_strdup(watch_for);
+		(*match) = new_service;
+		return (TRUE);
+	}
 
-    initng_service_cache_free(new_service);
+	initng_service_cache_free(new_service);
 
-    /* return null if not */
-    return (TRUE);
+	/* return null if not */
+	return (TRUE);
 }
 
 
@@ -712,721 +712,721 @@
 
 static int parse_opt(char **where, stype_h * type, service_cache_h * srv)
 {
-    s_entry *current = NULL;
-    char opt_name[MAX_OPT_LEN + 1];
-    char *var_name = NULL;
-    int opt_len = 0;
-    int var_len = 0;
-
-    DL_(*where, "parse_opt");
-
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "|                               "
-     */
-
-    JUMP_NSPACES(*where);
-    if (ENDED(*where))
-    {
-	FL_(*where, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	s_entry *current = NULL;
+	char opt_name[MAX_OPT_LEN + 1];
+	char *var_name = NULL;
+	int opt_len = 0;
+	int var_len = 0;
 
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "   |                            "
-     */
-
-    /* skip empty services */
-    if ((*where)[0] == '}')
-    {
-	FL_(*where, "found a } char here!");
-	return (FALSE);
-    }
+	DL_(*where, "parse_opt");
 
-    /* count number of chars this option name have */
-    if ((opt_len = strcspn((*where), "\n; \t=\"'")) < 1)
-    {
-	FL_(*where, "option name to short!");
-	return (FALSE);
-    }
+	/* Parsometer
+	 *
+	 * "   script start = /usr/bin/gdm; "
+	 * "|                               "
+	 */
 
-    /* get option name and strip all blanks from it */
-    if (opt_len >= MAX_OPT_LEN)
-    {
-	FL_(*where, "Max optlen 100 reached!");
-	return (FALSE);
-    }
-    strncpy(opt_name, (*where), opt_len);
-    opt_name[opt_len] = '\0';
-
-    /* walk */
-    (*where) += opt_len;
-    if (ENDED(*where))
-    {
-	FL_(*where, "Line just ended after variable name.");
-	return (FALSE);
-    }
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "         |                      "
-     */
-
-    JUMP_NSPACES(*where);
-    if (ENDED(*where))
-    {
-	FL_(*where, "Line just ended after variable name.");
-	return (FALSE);
-    }
+	JUMP_NSPACES(*where);
+	if (ENDED(*where))
+	{
+		FL_(*where, "Line ended unexpectedly.");
+		return (FALSE);
+	}
 
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "          |                     "
-     */
-    DL_(*where, "parse opt, before fetching opt name:");
+	/* Parsometer
+	 *
+	 * "   script start = /usr/bin/gdm; "
+	 * "   |                            "
+	 */
+
+	/* skip empty services */
+	if ((*where)[0] == '}')
+	{
+		FL_(*where, "found a } char here!");
+		return (FALSE);
+	}
 
-    if ((*where)[0] != '=' && (*where)[0] != ';')
-    {
 	/* count number of chars this option name have */
-	if (!(var_len = strcspn((*where), "\n; \t=\"'")))
+	if ((opt_len = strcspn((*where), "\n; \t=\"'")) < 1)
 	{
-	    FL_(*where, "variable name to short!");
-	    return (FALSE);
+		FL_(*where, "option name to short!");
+		return (FALSE);
 	}
 
 	/* get option name and strip all blanks from it */
-	if (var_len >= MAX_VAR_LEN)
+	if (opt_len >= MAX_OPT_LEN)
 	{
-	    FL_(*where, "Maximum variable name of 100 met.");
-	    return (FALSE);
+		FL_(*where, "Max optlen 100 reached!");
+		return (FALSE);
 	}
+	strncpy(opt_name, (*where), opt_len);
+	opt_name[opt_len] = '\0';
 
-	/* copy the string */
-	var_name = i_strndup(*where, var_len);
-
-	if (!is_valid(var_name))
+	/* walk */
+	(*where) += opt_len;
+	if (ENDED(*where))
 	{
-	    FL_(*where, "Variable name contains invalid characters.");
-	    return (FALSE);
+		FL_(*where, "Line just ended after variable name.");
+		return (FALSE);
 	}
-
-	DL_(*where, var_name);
-
-	(*where) += var_len;
-
-	DL_(*where, "EMPTYSPACE");
-
 	/* Parsometer
 	 *
 	 * "   script start = /usr/bin/gdm; "
-	 * "               |                "
+	 * "         |                      "
 	 */
+
 	JUMP_NSPACES(*where);
 	if (ENDED(*where))
 	{
-	    FL_(*where, "Line ended unexpectedly.");
-	    free(var_name);
-	    return (FALSE);
+		FL_(*where, "Line just ended after variable name.");
+		return (FALSE);
 	}
+
 	/* Parsometer
 	 *
 	 * "   script start = /usr/bin/gdm; "
-	 * "                |               "
+	 * "          |                     "
 	 */
+	DL_(*where, "parse opt, before fetching opt name:");
+
+	if ((*where)[0] != '=' && (*where)[0] != ';')
+	{
+		/* count number of chars this option name have */
+		if (!(var_len = strcspn((*where), "\n; \t=\"'")))
+		{
+			FL_(*where, "variable name to short!");
+			return (FALSE);
+		}
+
+		/* get option name and strip all blanks from it */
+		if (var_len >= MAX_VAR_LEN)
+		{
+			FL_(*where, "Maximum variable name of 100 met.");
+			return (FALSE);
+		}
+
+		/* copy the string */
+		var_name = i_strndup(*where, var_len);
 
+		if (!is_valid(var_name))
+		{
+			FL_(*where, "Variable name contains invalid characters.");
+			return (FALSE);
+		}
+
+		DL_(*where, var_name);
+
+		(*where) += var_len;
 
-    }
+		DL_(*where, "EMPTYSPACE");
+
+		/* Parsometer
+		 *
+		 * "   script start = /usr/bin/gdm; "
+		 * "               |                "
+		 */
+		JUMP_NSPACES(*where);
+		if (ENDED(*where))
+		{
+			FL_(*where, "Line ended unexpectedly.");
+			free(var_name);
+			return (FALSE);
+		}
+		/* Parsometer
+		 *
+		 * "   script start = /usr/bin/gdm; "
+		 * "                |               "
+		 */
 
-    DL_(*where, " Should be a '='");
 
-    /* walk the option db */
-    while_service_data_types(current)
-    {
-	/* temporary pointer storage */
-	s_entry *tmp = current;
-
-	/* make sure opt_name is set */
-	if (!current->opt_name)
-	    continue;
-
-	/* check that option is not marked for a certain service type */
-	if (current->ot && current->ot != type)
-	    continue;
-
-	/* check string length of word, this is faster then strcasecmp */
-	if (opt_len != current->opt_name_len)
-	{
-	    /*F_("Lenght is not correct.\n"); */
-	    continue;
-	}
-
-	/* finally, check if opt_name is what we are looking for */
-	if (strncmp(current->opt_name, opt_name, opt_len) != 0)
-	    continue;
-
-	D_("parse_opt(%s): option \"%s\" value at option.\n",
-	   srv->name, current->opt_name);
-
-	/* if this is a alias, browse forward to the correct opt_type */
-	while (tmp->opt_type == ALIAS && tmp->alias)
-	    tmp = tmp->alias;
-
-	D_("option type %i, var_name: %s, opt_name: %s\n", tmp->opt_type,
-	   var_name ? var_name : "(none)", current->opt_name);
-
-	DL_(*where, current->opt_name);
-
-	/* now switch the opt_type */
-	switch (tmp->opt_type)
-	{
-	    case STRING:
-	    case VARIABLE_STRING:
-		return (string_parser(current, where, var_name, srv));
-	    case STRINGS:
-	    case VARIABLE_STRINGS:
-		return (strings_parser(current, where, var_name, srv));
-	    case SET:
-	    case VARIABLE_SET:
-		return (set_parser(current, where, var_name, srv));
-	    case INT:
-	    case VARIABLE_INT:
-		return (iint_parser(current, where, var_name, srv));
-	    default:
-		break;
 	}
-	FL_(*where, "Unknown, or undefined type to parse!");
-	return (FALSE);
-    }
 
-    /* bail out if we did not find a match */
-    FL_(*where, "Did not get a MATCH!");
-    F_("Did not get an match on option: \"%s\"!\n", opt_name);
+	DL_(*where, " Should be a '='");
+
+	/* walk the option db */
+	while_service_data_types(current)
+	{
+		/* temporary pointer storage */
+		s_entry *tmp = current;
+
+		/* make sure opt_name is set */
+		if (!current->opt_name)
+			continue;
+
+		/* check that option is not marked for a certain service type */
+		if (current->ot && current->ot != type)
+			continue;
+
+		/* check string length of word, this is faster then strcasecmp */
+		if (opt_len != current->opt_name_len)
+		{
+			/*F_("Lenght is not correct.\n"); */
+			continue;
+		}
+
+		/* finally, check if opt_name is what we are looking for */
+		if (strncmp(current->opt_name, opt_name, opt_len) != 0)
+			continue;
+
+		D_("parse_opt(%s): option \"%s\" value at option.\n",
+		   srv->name, current->opt_name);
 
-    return (FALSE);
+		/* if this is a alias, browse forward to the correct opt_type */
+		while (tmp->opt_type == ALIAS && tmp->alias)
+			tmp = tmp->alias;
+
+		D_("option type %i, var_name: %s, opt_name: %s\n", tmp->opt_type,
+		   var_name ? var_name : "(none)", current->opt_name);
+
+		DL_(*where, current->opt_name);
+
+		/* now switch the opt_type */
+		switch (tmp->opt_type)
+		{
+			case STRING:
+			case VARIABLE_STRING:
+				return (string_parser(current, where, var_name, srv));
+			case STRINGS:
+			case VARIABLE_STRINGS:
+				return (strings_parser(current, where, var_name, srv));
+			case SET:
+			case VARIABLE_SET:
+				return (set_parser(current, where, var_name, srv));
+			case INT:
+			case VARIABLE_INT:
+				return (iint_parser(current, where, var_name, srv));
+			default:
+				break;
+		}
+		FL_(*where, "Unknown, or undefined type to parse!");
+		return (FALSE);
+	}
+
+	/* bail out if we did not find a match */
+	FL_(*where, "Did not get a MATCH!");
+	F_("Did not get an match on option: \"%s\"!\n", opt_name);
+
+	return (FALSE);
 }
 
 static int set_parser(s_entry * type, char **value
-		      __attribute__ ((unused)), char *va,
-		      service_cache_h * from_service)
+					  __attribute__ ((unused)), char *va,
+					  service_cache_h * from_service)
 {
-    assert(from_service);
-    assert(*value);
-    assert(value);
-
-    DL_(*value, "set_parser");
-    /*DEBUG{
-       char print[200];
-       sprintf(print, "set parser: type:%s va: %s service: %s", type->opt_name, va, from_service->name);
-       FL_(*value, print);
-       } */
-
-    /* Parsometer
-     *
-     * "   enable;"
-     * "         |"
-     */
-
-    if ((*value)[0] == ';')
-    {
-	D_("set_parser(%s,s,%s);\n", type->opt_name, from_service->name);
-	set_var(type, va, from_service);
-	return (TRUE);
-    }
+	assert(from_service);
+	assert(*value);
+	assert(value);
+
+	DL_(*value, "set_parser");
+	/*DEBUG{
+	   char print[200];
+	   sprintf(print, "set parser: type:%s va: %s service: %s", type->opt_name, va, from_service->name);
+	   FL_(*value, print);
+	   } */
 
-    /* Parsometer
-     *
-     * "   enable = yes"
-     * "          |    "
-     */
-    if ((*value)[0] != '=')
-    {
-	FL_(*value, "There should be an ';' or '=' here!");
-	return (FALSE);
-    }
+	/* Parsometer
+	 *
+	 * "   enable;"
+	 * "         |"
+	 */
 
-    /* skip the '=' char */
-    (*value)++;
-    JUMP_NSPACES(*value);
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	if ((*value)[0] == ';')
+	{
+		D_("set_parser(%s,s,%s);\n", type->opt_name, from_service->name);
+		set_var(type, va, from_service);
+		return (TRUE);
+	}
 
-    /* Parsometer
-     *
-     * "   enable = yes"
-     * "            |  "
-     */
-    if (strncasecmp(*value, "yes", 3) == 0)
-    {
-	D_("set_parser(%s,s,%s);\n", type->opt_name, from_service->name);
-	set_var(type, va, from_service);
+	/* Parsometer
+	 *
+	 * "   enable = yes"
+	 * "          |    "
+	 */
+	if ((*value)[0] != '=')
+	{
+		FL_(*value, "There should be an ';' or '=' here!");
+		return (FALSE);
+	}
 
-	/* skip 3 chars */
-	(*value) += 3;
-	return (TRUE);
-    }
+	/* skip the '=' char */
+	(*value)++;
+	JUMP_NSPACES(*value);
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
 
-    if (strncasecmp(*value, "true", 4) == 0)
-    {
-	D_("set_parser(%s,s,%s);\n", type->opt_name, from_service->name);
-	set_var(type, va, from_service);
+	/* Parsometer
+	 *
+	 * "   enable = yes"
+	 * "            |  "
+	 */
+	if (strncasecmp(*value, "yes", 3) == 0)
+	{
+		D_("set_parser(%s,s,%s);\n", type->opt_name, from_service->name);
+		set_var(type, va, from_service);
 
-	/* skip 4 chars */
-	(*value) += 4;
-	return (TRUE);
-    }
+		/* skip 3 chars */
+		(*value) += 3;
+		return (TRUE);
+	}
+
+	if (strncasecmp(*value, "true", 4) == 0)
+	{
+		D_("set_parser(%s,s,%s);\n", type->opt_name, from_service->name);
+		set_var(type, va, from_service);
 
-    /* else, remove */
-    dfree_var(type, va, from_service);
-    return (TRUE);
+		/* skip 4 chars */
+		(*value) += 4;
+		return (TRUE);
+	}
+
+	/* else, remove */
+	dfree_var(type, va, from_service);
+	return (TRUE);
 }
 
 
 static int string_parser(s_entry * type, char **value, char *va,
-			 service_cache_h * from_service)
+						 service_cache_h * from_service)
 {
-    char *to;
-
-    assert(from_service);
-    assert(*value);
-    assert(value);
-
-    /*FL_(*value, "stringparser"); */
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "                |               "
-     */
-
-    DL_(*value, "string_parser()");
-    if ((*value)[0] != '=')
-    {
-	FL_(*value, "There should be an = here.");
-	return (FALSE);
-    }
+	char *to;
 
-    (*value)++;
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "                 |              "
-     */
-    JUMP_NSPACES(*value);
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	assert(from_service);
+	assert(*value);
+	assert(value);
 
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "                  |             "
-     */
+	/*FL_(*value, "stringparser"); */
+	/* Parsometer
+	 *
+	 * "   script start = /usr/bin/gdm; "
+	 * "                |               "
+	 */
 
-    /* duplicate next word, or string content */
-    to = dup_string_and_walk(value, FALSE);
+	DL_(*value, "string_parser()");
+	if ((*value)[0] != '=')
+	{
+		FL_(*value, "There should be an = here.");
+		return (FALSE);
+	}
 
-    /* go to the end and stay there */
-    while ((*value)[0] && (*value)[0] != ';')
 	(*value)++;
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
+	/* Parsometer
+	 *
+	 * "   script start = /usr/bin/gdm; "
+	 * "                 |              "
+	 */
+	JUMP_NSPACES(*value);
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
 
-    DL_(*value, "skip to the ';' char");
+	/* Parsometer
+	 *
+	 * "   script start = /usr/bin/gdm; "
+	 * "                  |             "
+	 */
 
-    /* Parsometer
-     *
-     * "   script start = /usr/bin/gdm; "
-     * "                              | "
-     */
-    /* make sure the end is a ';' */
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	free(to);
-	return (FALSE);
-    }
+	/* duplicate next word, or string content */
+	to = dup_string_and_walk(value, FALSE);
 
-    if ((*value)[0] != ';')
-    {
-	FL_(*value, "There should be an ; here.");
-	if ((*value)[0] == '\n')
-	    F_("Its a *newline* instead.\n");
-	else
-	    F_("Its a %c instead.\n", (*value)[0]);
-	return (FALSE);
-    }
+	/* go to the end and stay there */
+	while ((*value)[0] && (*value)[0] != ';')
+		(*value)++;
 
+	DL_(*value, "skip to the ';' char");
 
+	/* Parsometer
+	 *
+	 * "   script start = /usr/bin/gdm; "
+	 * "                              | "
+	 */
+	/* make sure the end is a ';' */
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		free(to);
+		return (FALSE);
+	}
 
-    set_string_var(type, va, from_service, to);
-    return (TRUE);
+	if ((*value)[0] != ';')
+	{
+		FL_(*value, "There should be an ; here.");
+		if ((*value)[0] == '\n')
+			F_("Its a *newline* instead.\n");
+		else
+			F_("Its a %c instead.\n", (*value)[0]);
+		return (FALSE);
+	}
+
+
+
+	set_string_var(type, va, from_service, to);
+	return (TRUE);
 }
 
 static int iint_parser(s_entry * type, char **value, char *va,
-		       service_cache_h * from_service)
+					   service_cache_h * from_service)
 {
-    char to[11];
-    int len = 0;
+	char to[11];
+	int len = 0;
 
-    assert(from_service);
-    assert(*value);
-    assert(value);
-
-    /*FL_(*value, "intparser"); */
-    /* Parsometer
-     *
-     * "   pause = 10; "
-     * "         |     "
-     */
-
-    if ((*value)[0] != '=')
-    {
-	FL_(*value, "Missing an '=' here.");
-	return (FALSE);
-    }
+	assert(from_service);
+	assert(*value);
+	assert(value);
 
-    (*value)++;
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	/*FL_(*value, "intparser"); */
+	/* Parsometer
+	 *
+	 * "   pause = 10; "
+	 * "         |     "
+	 */
 
-    /* Parsometer
-     *
-     * "   pause = 10; "
-     * "          |    "
-     */
-
-    JUMP_NSPACES(*value);
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	if ((*value)[0] != '=')
+	{
+		FL_(*value, "Missing an '=' here.");
+		return (FALSE);
+	}
 
-    /* Parsometer
-     *
-     * "   pause = 10; "
-     * "           |   "
-     */
-
-    len = strcspn(*value, "\n;");
-    /* make sure the end is a ';' */
-    if ((*value)[len] != ';')
-    {
-	FL_(*value, "Missing an ';' char.");
-	return (FALSE);
-    }
+	(*value)++;
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
 
-    /* make sure value is not to big */
-    if (len >= 10)
-    {
-	FL_(*value, "Length is bigger than 10.");
-	return (FALSE);
-    }
+	/* Parsometer
+	 *
+	 * "   pause = 10; "
+	 * "          |    "
+	 */
 
-    /* ok, copy the code */
-    strncpy(to, *value, len);
-    to[len] = '\0';
-
-    /* walk */
-    (*value) += len;
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	JUMP_NSPACES(*value);
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
+
+	/* Parsometer
+	 *
+	 * "   pause = 10; "
+	 * "           |   "
+	 */
+
+	len = strcspn(*value, "\n;");
+	/* make sure the end is a ';' */
+	if ((*value)[len] != ';')
+	{
+		FL_(*value, "Missing an ';' char.");
+		return (FALSE);
+	}
 
-    set_int_var(type, va, from_service, atoi(to));
-    return (TRUE);
+	/* make sure value is not to big */
+	if (len >= 10)
+	{
+		FL_(*value, "Length is bigger than 10.");
+		return (FALSE);
+	}
+
+	/* ok, copy the code */
+	strncpy(to, *value, len);
+	to[len] = '\0';
+
+	/* walk */
+	(*value) += len;
+	if (ENDED(*value))
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
+
+	set_int_var(type, va, from_service, atoi(to));
+	return (TRUE);
 }
 
 static int strings_parser(s_entry * type, char **value, char *va,
-			  service_cache_h * from_service)
+						  service_cache_h * from_service)
 {
-    char *to = NULL;
+	char *to = NULL;
 
-    assert(from_service);
-    assert(*value);
-    assert(value);
-
-    /*FL_(*value, "stringS parser"); */
-    /* Parsometer
-     *
-     * "   need = test service; "
-     * "        |               "
-     */
-    DL_(*value, "strings_parser()");
-
-
-    if ((*value)[0] != '=')
-    {
-	FL_(*value, "Missing an '=' here.");
-	return (FALSE);
-    }
+	assert(from_service);
+	assert(*value);
+	assert(value);
 
-    (*value)++;
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
+	/*FL_(*value, "stringS parser"); */
+	/* Parsometer
+	 *
+	 * "   need = test service; "
+	 * "        |               "
+	 */
+	DL_(*value, "strings_parser()");
 
-    /* Parsometer
-     *
-     * "   need = test service; "
-     * "         |              "
-     */
-    JUMP_NSPACES(*value);
-    if (ENDED(*value))
-    {
-	FL_(*value, "Line ended unexpectedly.");
-	return (FALSE);
-    }
-    /* Parsometer
-     *
-     * "   need = test service; "
-     * "          |             "
-     */
-    DL_(*value,
-	"strings_parser, Youst before dup_string_and_walk(value, TRUE)");
-
-    while ((to = dup_string_and_walk(value, TRUE)))
-    {
-	DL_(*value, "adding");
-	if (va)
+
+	if ((*value)[0] != '=')
 	{
-	    set_another_string_var(type, i_strdup(va), from_service, to);
+		FL_(*value, "Missing an '=' here.");
+		return (FALSE);
 	}
-	else
+
+	(*value)++;
+	if (ENDED(*value))
 	{
-	    set_another_string_var(type, NULL, from_service, to);
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
 	}
-	/* check if this is end */
-	if ((*value)[0] == ';')
-	    break;
 
+	/* Parsometer
+	 *
+	 * "   need = test service; "
+	 * "         |              "
+	 */
 	JUMP_NSPACES(*value);
-
-	/* check if this is end */
-	if ((*value)[0] == ';')
-	    break;
 	if (ENDED(*value))
-	    break;
-	DL_(*value, "a_add");
-    }
-
-    /* dont forgot to free va */
-    if (va)
-    {
-	free(va);
-	va = NULL;
-    }
-    /* Parsometer
-     *
-     * "   need = test service; "
-     * "                      | "
-     */
-
-    DL_(*value, "all added");
-    if ((*value)[0] != ';')
-    {
-	FL_(*value, "End char is not an ';'.");
-	return (FALSE);
-    }
-    return (TRUE);
+	{
+		FL_(*value, "Line ended unexpectedly.");
+		return (FALSE);
+	}
+	/* Parsometer
+	 *
+	 * "   need = test service; "
+	 * "          |             "
+	 */
+	DL_(*value,
+		"strings_parser, Youst before dup_string_and_walk(value, TRUE)");
+
+	while ((to = dup_string_and_walk(value, TRUE)))
+	{
+		DL_(*value, "adding");
+		if (va)
+		{
+			set_another_string_var(type, i_strdup(va), from_service, to);
+		}
+		else
+		{
+			set_another_string_var(type, NULL, from_service, to);
+		}
+		/* check if this is end */
+		if ((*value)[0] == ';')
+			break;
+
+		JUMP_NSPACES(*value);
+
+		/* check if this is end */
+		if ((*value)[0] == ';')
+			break;
+		if (ENDED(*value))
+			break;
+		DL_(*value, "a_add");
+	}
+
+	/* dont forgot to free va */
+	if (va)
+	{
+		free(va);
+		va = NULL;
+	}
+	/* Parsometer
+	 *
+	 * "   need = test service; "
+	 * "                      | "
+	 */
+
+	DL_(*value, "all added");
+	if ((*value)[0] != ';')
+	{
+		FL_(*value, "End char is not an ';'.");
+		return (FALSE);
+	}
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
 
-    D_("i_parser: module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("i_parser: module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    return (initng_plugin_hook_add(&g.PARSERS, 50, &initng_i_parser));
+	return (initng_plugin_hook_add(&g.PARSERS, 50, &initng_i_parser));
 
 }
 
 void module_unload(void)
 {
-    D_("i_parser: module_unload();\n");
-    initng_plugin_hook_del(&g.PARSERS, &initng_i_parser);
+	D_("i_parser: module_unload();\n");
+	initng_plugin_hook_del(&g.PARSERS, &initng_i_parser);
 }
 
 
 static char *dup_string_and_walk(char **value, int space_is_new_word)
 {
-    char *to = NULL;
-    int len = 0;
+	char *to = NULL;
+	int len = 0;
+
+	/* Parsometer
+	 *
+	 * "   script start = { /usr/bin/gdm };            "
+	 * "   script start = "/usr/bin/gdm";              "
+	 * "   script start = /usr/bin/gdm;                "
+	 * "   script start = /usr/bin/gdm /usr/sbin/gdm;  "
+	 * "                  |                            "
+	 */
 
-    /* Parsometer
-     *
-     * "   script start = { /usr/bin/gdm };            "
-     * "   script start = "/usr/bin/gdm";              "
-     * "   script start = /usr/bin/gdm;                "
-     * "   script start = /usr/bin/gdm /usr/sbin/gdm;  "
-     * "                  |                            "
-     */
-
-
-    if (space_is_new_word == TRUE)
-    {
-	DL_(*value, "Space is new word");
-    }
-    else
-    {
-	DL_(*value, "Space is none word");
-    }
-
-    DL_(*value, "dup_string_and_walk:");
 
+	if (space_is_new_word == TRUE)
+	{
+		DL_(*value, "Space is new word");
+	}
+	else
+	{
+		DL_(*value, "Space is none word");
+	}
 
+	DL_(*value, "dup_string_and_walk:");
 
-    /* If this value we should copy is stacked in braces */
-    if ((*value)[0] == '{')
-    {
-	int stack = 1;
 
-	(*value)++;
+
+	/* If this value we should copy is stacked in braces */
+	if ((*value)[0] == '{')
+	{
+		int stack = 1;
+
+		(*value)++;
 
 #ifndef NOTRIM
-	JUMP_NSPACES(*value);
+		JUMP_NSPACES(*value);
 #endif
-	/* count length to the '}' char */
-	while ((*value)[len])
-	{
-	    if ((*value)[len] == '{')
-		stack++;
-	    else if ((*value)[len] == '}')
-		stack--;
-
-	    /* if stack is zero or below, we are standing on a '}' with no escape char before */
-	    if (stack <= 0 && (*value)[len] == '}'
-		&& (*value)[len - 1] != '\\')
-	    {
-		(*value)[len] = ';';
-		break;
-	    }
-	    len++;
-	}
+		/* count length to the '}' char */
+		while ((*value)[len])
+		{
+			if ((*value)[len] == '{')
+				stack++;
+			else if ((*value)[len] == '}')
+				stack--;
+
+			/* if stack is zero or below, we are standing on a '}' with no escape char before */
+			if (stack <= 0 && (*value)[len] == '}'
+				&& (*value)[len - 1] != '\\')
+			{
+				(*value)[len] = ';';
+				break;
+			}
+			len++;
+		}
 
 #ifndef NOTRIM
-	while ((*value)[len - 1] == ' ' || (*value)[len - 1] == '\t'
-	       || (*value)[len - 1] == '\n')
-	    len--;
+		while ((*value)[len - 1] == ' ' || (*value)[len - 1] == '\t'
+			   || (*value)[len - 1] == '\n')
+			len--;
 #endif
-	/* ok, copy the code */
-	if (!(to = i_strndup(*value, len)))
-	{
-	    FL_(*value, "Failed copying.");
-	    return (NULL);
-	}
+		/* ok, copy the code */
+		if (!(to = i_strndup(*value, len)))
+		{
+			FL_(*value, "Failed copying.");
+			return (NULL);
+		}
 
-	/* walk forward again */
-	(*value) += len;
+		/* walk forward again */
+		(*value) += len;
 
 #ifndef NOTRIM
-	JUMP_NSPACES(*value);
+		JUMP_NSPACES(*value);
 #endif
-	if ((*value)[0] == '}')
-	    (*value)++;
+		if ((*value)[0] == '}')
+			(*value)++;
 
-	DL_(*value, "after += len");
+		DL_(*value, "after += len");
 
-	return (to);
+		return (to);
+
+	}
 
-    }
 
+	/* if it is embraced in with '"' */
+	if ((*value)[0] == '"')
+	{
+		/* skip the '"' char */
+		(*value)++;
 
-    /* if it is embraced in with '"' */
-    if ((*value)[0] == '"')
-    {
-	/* skip the '"' char */
-	(*value)++;
+		/* count the number of tokens */
+		while ((*value)[len])
+		{
+			/* if this is the ending '"' with no escape char before */
+			if ((*value)[len] == '"' && (*value)[len - 1] != '\\')
+			{
+				break;
+			}
+			len++;
+		}
 
-	/* count the number of tokens */
+		/* ok, copy the code */
+		if (!(to = i_strndup(*value, len)))
+		{
+			FL_(*value, "Failed copying.");
+			return (NULL);
+		}
+
+		/* walk forward again */
+		(*value) += len;
+		if ((*value)[0] == '"')
+			(*value)++;
+
+		DL_(*value, "after += len");
+
+		return (to);
+	}
+
+	/* else */
+	DL_(*value, "Non stack or quoted value");
+
+	/* Count length */
 	while ((*value)[len])
 	{
-	    /* if this is the ending '"' with no escape char before */
-	    if ((*value)[len] == '"' && (*value)[len - 1] != '\\')
-	    {
-		break;
-	    }
-	    len++;
+		/* this char is escaped by the char before */
+		if ((*value)[len - 1] == '\\')
+		{
+			len++;
+			continue;
+		}
+
+		/* If we should break copying on a space, check this */
+		if (space_is_new_word == TRUE)
+		{
+			DL_(*value, "Space is new word");
+			if ((*value)[len] == ' ' || (*value)[len] == '\t'
+				|| (*value)[len] == '\n')
+				break;
+		}
+
+		/* always break on a ; */
+		if ((*value)[len] == ';')
+			break;
+
+		len++;
 	}
 
 	/* ok, copy the code */
 	if (!(to = i_strndup(*value, len)))
 	{
-	    FL_(*value, "Failed copying.");
-	    return (NULL);
+		FL_(*value, "Failed copying.");
+		return (FALSE);
 	}
 
 	/* walk forward again */
 	(*value) += len;
-	if ((*value)[0] == '"')
-	    (*value)++;
-
 	DL_(*value, "after += len");
 
 	return (to);
-    }
-
-    /* else */
-    DL_(*value, "Non stack or quoted value");
-
-    /* Count length */
-    while ((*value)[len])
-    {
-	/* this char is escaped by the char before */
-	if ((*value)[len - 1] == '\\')
-	{
-	    len++;
-	    continue;
-	}
-
-	/* If we should break copying on a space, check this */
-	if (space_is_new_word == TRUE)
-	{
-	    DL_(*value, "Space is new word");
-	    if ((*value)[len] == ' ' || (*value)[len] == '\t'
-		|| (*value)[len] == '\n')
-		break;
-	}
-
-	/* always break on a ; */
-	if ((*value)[len] == ';')
-	    break;
-
-	len++;
-    }
-
-    /* ok, copy the code */
-    if (!(to = i_strndup(*value, len)))
-    {
-	FL_(*value, "Failed copying.");
-	return (FALSE);
-    }
-
-    /* walk forward again */
-    (*value) += len;
-    DL_(*value, "after += len");
-
-    return (to);
 }

Modified: initng/trunk/plugins/last/initng_last.c
==============================================================================
--- initng/trunk/plugins/last/initng_last.c	(original)
+++ initng/trunk/plugins/last/initng_last.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 
@@ -36,77 +36,77 @@
 #include <initng_static_service_types.h>
 
 s_entry LAST = { "last", SET, NULL,
-    "If this option is set, you will be sure this service is started last."
+	"If this option is set, you will be sure this service is started last."
 };
 
 
 /* returns TRUE if all use deps are started */
 static int check_last(active_db_h * service)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* And LAST is set. */
-    if (!is(&LAST, service))
-	return (TRUE);
-
-    /* ok check with all service */
-    D_("LAST: walking through service db\n");
-    while_active_db(current)
-    {
-	/* don't check ourself */
-	if (current == service)
-	    continue;
-
-	/* ignore runlevels */
-	/* TODO 20051105 SaTaN0rX: i do not know why i need to check for this */
-	/*if (current->type == &TYPE_RUNLEVEL)
-	   continue; */
-
-	/* if this service also should be started last, continue */
-	if (is(&LAST, current))
-	    continue;
-
-	/* TODO, use dep_on_deep */
-	/* if current need service that should be last */
-	if (initng_depend_deep(current, service) == TRUE)
-	{
-	    /* don't wait, because this wait is circular */
-	    D_("Service %s depends on %s\n", service->name, current->name);
-	    continue;
-	}
-
-	if (IS_STARTING(current))
+	/* And LAST is set. */
+	if (!is(&LAST, service))
+		return (TRUE);
+
+	/* ok check with all service */
+	D_("LAST: walking through service db\n");
+	while_active_db(current)
 	{
-	    D_("Service %s is also starting, and %s should be started last\n",
-	       current->name, service->name);
-	    return (FALSE);
+		/* don't check ourself */
+		if (current == service)
+			continue;
+
+		/* ignore runlevels */
+		/* TODO 20051105 SaTaN0rX: i do not know why i need to check for this */
+		/*if (current->type == &TYPE_RUNLEVEL)
+		   continue; */
+
+		/* if this service also should be started last, continue */
+		if (is(&LAST, current))
+			continue;
+
+		/* TODO, use dep_on_deep */
+		/* if current need service that should be last */
+		if (initng_depend_deep(current, service) == TRUE)
+		{
+			/* don't wait, because this wait is circular */
+			D_("Service %s depends on %s\n", service->name, current->name);
+			continue;
+		}
+
+		if (IS_STARTING(current))
+		{
+			D_("Service %s is also starting, and %s should be started last\n",
+			   current->name, service->name);
+			return (FALSE);
+		}
 	}
-    }
 
-    /* ok, finally last start this */
-    return (TRUE);
+	/* ok, finally last start this */
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&LAST);
-    initng_plugin_hook_add(&g.START_DEP_MET, 99, &check_last);
-    return (TRUE);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&LAST);
+	initng_plugin_hook_add(&g.START_DEP_MET, 99, &check_last);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&LAST);
-    initng_plugin_hook_del(&g.START_DEP_MET, &check_last);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&LAST);
+	initng_plugin_hook_del(&g.START_DEP_MET, &check_last);
 }

Modified: initng/trunk/plugins/limit/initng_limit.c
==============================================================================
--- initng/trunk/plugins/limit/initng_limit.c	(original)
+++ initng/trunk/plugins/limit/initng_limit.c	Wed Apr  5 23:11:19 2006
@@ -36,274 +36,274 @@
 
 /* stolen from man setrlimit */
 s_entry RLIMIT_AS_SOFT = { "rlimit_as_soft", INT, NULL,
-    "The maximum size of process virtual memory, soft limit."
+	"The maximum size of process virtual memory, soft limit."
 };
 s_entry RLIMIT_AS_HARD = { "rlimit_as_hard", INT, NULL,
-    "The maximum size of process virtual memory, hard limit."
+	"The maximum size of process virtual memory, hard limit."
 };
 s_entry RLIMIT_CORE_SOFT = { "rlimit_core_soft", INT, NULL,
-    "The maximum size of the core file, soft limit."
+	"The maximum size of the core file, soft limit."
 };
 s_entry RLIMIT_CORE_HARD = { "rlimit_core_hard", INT, NULL,
-    "The maximum size of the core file, hard limit."
+	"The maximum size of the core file, hard limit."
 };
 s_entry RLIMIT_CPU_SOFT = { "rlimit_cpu_soft", INT, NULL,
-    "The maximum of cputime, in seconds processes can use, soft limit."
+	"The maximum of cputime, in seconds processes can use, soft limit."
 };
 s_entry RLIMIT_CPU_HARD = { "rlimit_cpu_hard", INT, NULL,
-    "The maximum of cputime, in seconds processes can use, hard limit."
+	"The maximum of cputime, in seconds processes can use, hard limit."
 };
 s_entry RLIMIT_DATA_SOFT = { "rlimit_data_soft", INT, NULL,
-    "The maximum size of the process uninitalized data, soft limit."
+	"The maximum size of the process uninitalized data, soft limit."
 };
 s_entry RLIMIT_DATA_HARD = { "rlimit_data_hard", INT, NULL,
-    "The maximum size of the process uninitalized data, hard limit."
+	"The maximum size of the process uninitalized data, hard limit."
 };
 s_entry RLIMIT_FSIZE_SOFT = { "rlimit_fsize_soft", INT, NULL,
-    "The maximum filesize of a file the process can create, soft limit."
+	"The maximum filesize of a file the process can create, soft limit."
 };
 s_entry RLIMIT_FSIZE_HARD = { "rlimit_fsize_hard", INT, NULL,
-    "The maximum filesize of a file the process can create, hard limit."
+	"The maximum filesize of a file the process can create, hard limit."
 };
 s_entry RLIMIT_MEMLOCK_SOFT = { "rlimit_memlock_soft", INT, NULL,
-    "The maximum amount of memory, the process can lock, soft limit."
+	"The maximum amount of memory, the process can lock, soft limit."
 };
 s_entry RLIMIT_MEMLOCK_HARD = { "rlimit_memlock_hard", INT, NULL,
-    "The maximum amount of memory, the process can lock, hard limit."
+	"The maximum amount of memory, the process can lock, hard limit."
 };
 s_entry RLIMIT_NOFILE_SOFT = { "rlimit_nofile_soft", INT, NULL,
-    "The maximum number of files the process can open, at the same time, soft limit."
+	"The maximum number of files the process can open, at the same time, soft limit."
 };
 s_entry RLIMIT_NOFILE_HARD = { "rlimit_nofile_hard", INT, NULL,
-    "The maximum number of files the process can open, at the same time, hard limit."
+	"The maximum number of files the process can open, at the same time, hard limit."
 };
 s_entry RLIMIT_NPROC_SOFT = { "rlimit_nproc_soft", INT, NULL,
-    "The maximum number of processes that can be created, soft limit."
+	"The maximum number of processes that can be created, soft limit."
 };
 s_entry RLIMIT_NPROC_HARD = { "rlimit_nproc_hard", INT, NULL,
-    "The maximum number of processes that can be created, hard limit."
+	"The maximum number of processes that can be created, hard limit."
 };
 s_entry RLIMIT_RSS_SOFT = { "rlimit_rss_soft", INT, NULL,
-    "The maximum no of virtual pages in ram, soft limit."
+	"The maximum no of virtual pages in ram, soft limit."
 };
 s_entry RLIMIT_RSS_HARD = { "rlimit_rss_hard", INT, NULL,
-    "The maximum no of virtual pages in ram, hard limit."
+	"The maximum no of virtual pages in ram, hard limit."
 };
 s_entry RLIMIT_SIGPENDING_SOFT = { "rlimit_sigpending_soft", INT, NULL,
-    "The maximum amount of signals that can be queued, soft limit."
+	"The maximum amount of signals that can be queued, soft limit."
 };
 s_entry RLIMIT_SIGPENDING_HARD = { "rlimit_sigpending_hard", INT, NULL,
-    "The maximum amount of signals that can be queued, soft limit."
+	"The maximum amount of signals that can be queued, soft limit."
 };
 s_entry RLIMIT_STACK_SOFT = { "rlimit_stack_soft", INT, NULL,
-    "The maximum size of the process stack, hard limit."
+	"The maximum size of the process stack, hard limit."
 };
 s_entry RLIMIT_STACK_HARD = { "rlimit_stack_hard", INT, NULL,
-    "The maximum size of the process stack, soft limit."
+	"The maximum size of the process stack, soft limit."
 };
 
 /* fetch the correct error string */
 static const char *err_desc(void)
 {
-    switch (errno)
-    {
-	case EFAULT:
-	    return ("Rlim prints outside the accessible address space.\n");
-	case EINVAL:
-	    return ("Resource is not valid.\n");
-	case EPERM:
-	    return ("Unprivileged process tried to set rlimit.\n");
-	default:
-	    break;
-    }
-    return (NULL);
+	switch (errno)
+	{
+		case EFAULT:
+			return ("Rlim prints outside the accessible address space.\n");
+		case EINVAL:
+			return ("Resource is not valid.\n");
+		case EPERM:
+			return ("Unprivileged process tried to set rlimit.\n");
+		default:
+			break;
+	}
+	return (NULL);
 }
 
 /* this function set rlimit if it should, w-o overwriting old values. */
 static int set_limit(s_entry * soft, s_entry * hard, active_db_h * service,
-		     int ltype, int times)
+					 int ltype, int times)
 {
-    int si = FALSE;
-    int sh = FALSE;
-    struct rlimit l;
-
-    /* check if the limits are set */
-    si = is(soft, service);
-    sh = is(hard, service);
+	int si = FALSE;
+	int sh = FALSE;
+	struct rlimit l;
+
+	/* check if the limits are set */
+	si = is(soft, service);
+	sh = is(hard, service);
+
+	/* make sure any is set */
+	if (si == FALSE && sh == FALSE)
+		return (0);
+
+	/* get the current limit data */
+	if (getrlimit(ltype, &l) != 0)
+	{
+		F_("getrlimit failed!, service %s, limit type %i: %s\n",
+		   service->name, ltype, err_desc());
+		return (-1);
+	}
+
+	D_("current: soft: %i, hard: %i\n", l.rlim_cur, l.rlim_max);
+	/* if soft limit is set, get it */
+	if (si)
+	{
+		l.rlim_cur = (get_int(soft, service) * times);
+	}
+
+	/* if hard limit is set, get it */
+	if (sh)
+	{
+		l.rlim_max = (get_int(hard, service) * times);
+	}
+
+	/* make sure hard is at least same big, but hopefully bigger. */
+	if (l.rlim_cur > l.rlim_max)
+		l.rlim_max = l.rlim_cur;
+
+	D_("now: soft: %i, hard: %i\n", l.rlim_cur, l.rlim_max);
+
+	/* set the limit and return status */
+	if (setrlimit(ltype, &l) != 0)
+	{
+		F_("setrlimit failed, service: %s, limit type %i: %s\n",
+		   service->name, ltype, err_desc());
+		return (-1);
+	}
 
-    /* make sure any is set */
-    if (si == FALSE && sh == FALSE)
 	return (0);
-
-    /* get the current limit data */
-    if (getrlimit(ltype, &l) != 0)
-    {
-	F_("getrlimit failed!, service %s, limit type %i: %s\n",
-	   service->name, ltype, err_desc());
-	return (-1);
-    }
-
-    D_("current: soft: %i, hard: %i\n", l.rlim_cur, l.rlim_max);
-    /* if soft limit is set, get it */
-    if (si)
-    {
-	l.rlim_cur = (get_int(soft, service) * times);
-    }
-
-    /* if hard limit is set, get it */
-    if (sh)
-    {
-	l.rlim_max = (get_int(hard, service) * times);
-    }
-
-    /* make sure hard is at least same big, but hopefully bigger. */
-    if (l.rlim_cur > l.rlim_max)
-	l.rlim_max = l.rlim_cur;
-
-    D_("now: soft: %i, hard: %i\n", l.rlim_cur, l.rlim_max);
-
-    /* set the limit and return status */
-    if (setrlimit(ltype, &l) != 0)
-    {
-	F_("setrlimit failed, service: %s, limit type %i: %s\n",
-	   service->name, ltype, err_desc());
-	return (-1);
-    }
-
-    return (0);
 }
 
 static int do_limit(active_db_h * s, process_h * p __attribute__ ((unused)))
 {
-    int ret = 0;
+	int ret = 0;
 
-    assert(s);
-    assert(s->name);
-    assert(p);
+	assert(s);
+	assert(s->name);
+	assert(p);
 
-    D_("do_limit!\n");
+	D_("do_limit!\n");
 
-    /* Handle RLIMIT_AS */
-    ret += set_limit(&RLIMIT_AS_SOFT, &RLIMIT_AS_HARD, s, RLIMIT_AS, 1024);
+	/* Handle RLIMIT_AS */
+	ret += set_limit(&RLIMIT_AS_SOFT, &RLIMIT_AS_HARD, s, RLIMIT_AS, 1024);
 
-    /* Handle RLIMIT_CORE */
-    ret += set_limit(&RLIMIT_CORE_SOFT, &RLIMIT_CORE_HARD, s, RLIMIT_CORE,
-		     1024);
+	/* Handle RLIMIT_CORE */
+	ret += set_limit(&RLIMIT_CORE_SOFT, &RLIMIT_CORE_HARD, s, RLIMIT_CORE,
+					 1024);
 
-    /* Handle RLIMIT_CPU */
-    ret += set_limit(&RLIMIT_CPU_SOFT, &RLIMIT_CPU_HARD, s, RLIMIT_CPU, 1);
+	/* Handle RLIMIT_CPU */
+	ret += set_limit(&RLIMIT_CPU_SOFT, &RLIMIT_CPU_HARD, s, RLIMIT_CPU, 1);
 
-    /* Handle RLIMIT_DATA */
-    ret += set_limit(&RLIMIT_DATA_SOFT, &RLIMIT_DATA_HARD, s, RLIMIT_DATA,
-		     1024);
+	/* Handle RLIMIT_DATA */
+	ret += set_limit(&RLIMIT_DATA_SOFT, &RLIMIT_DATA_HARD, s, RLIMIT_DATA,
+					 1024);
 
-    /* Handle RLIMIT_FSIZE */
-    ret += set_limit(&RLIMIT_FSIZE_SOFT, &RLIMIT_FSIZE_HARD, s, RLIMIT_FSIZE,
-		     1024);
+	/* Handle RLIMIT_FSIZE */
+	ret += set_limit(&RLIMIT_FSIZE_SOFT, &RLIMIT_FSIZE_HARD, s, RLIMIT_FSIZE,
+					 1024);
 
-    /* Handle RLIMIT_MEMLOCK */
-    ret += set_limit(&RLIMIT_MEMLOCK_SOFT, &RLIMIT_MEMLOCK_HARD, s,
-		     RLIMIT_MEMLOCK, 1024);
+	/* Handle RLIMIT_MEMLOCK */
+	ret += set_limit(&RLIMIT_MEMLOCK_SOFT, &RLIMIT_MEMLOCK_HARD, s,
+					 RLIMIT_MEMLOCK, 1024);
 
-    /* Handle RLIMIT_NOFILE */
-    ret += set_limit(&RLIMIT_NOFILE_SOFT, &RLIMIT_NOFILE_HARD, s,
-		     RLIMIT_NOFILE, 1);
+	/* Handle RLIMIT_NOFILE */
+	ret += set_limit(&RLIMIT_NOFILE_SOFT, &RLIMIT_NOFILE_HARD, s,
+					 RLIMIT_NOFILE, 1);
 
-    /* Handle RLIMIT_NPROC */
-    ret += set_limit(&RLIMIT_NPROC_SOFT, &RLIMIT_NPROC_HARD, s, RLIMIT_NPROC,
-		     1);
+	/* Handle RLIMIT_NPROC */
+	ret += set_limit(&RLIMIT_NPROC_SOFT, &RLIMIT_NPROC_HARD, s, RLIMIT_NPROC,
+					 1);
 
-    /* Handle RLIMIT_RSS */
-    ret += set_limit(&RLIMIT_RSS_SOFT, &RLIMIT_RSS_HARD, s, RLIMIT_RSS, 1024);
+	/* Handle RLIMIT_RSS */
+	ret += set_limit(&RLIMIT_RSS_SOFT, &RLIMIT_RSS_HARD, s, RLIMIT_RSS, 1024);
 
 #ifdef RLIMIT_SIGPENDING
-    /* for some reason, this seems missing on some systems */
-    /* Handle RLIMIT_SIGPENDING */
-    ret += set_limit(&RLIMIT_SIGPENDING_SOFT, &RLIMIT_SIGPENDING_HARD, s,
-		     RLIMIT_SIGPENDING, 1);
+	/* for some reason, this seems missing on some systems */
+	/* Handle RLIMIT_SIGPENDING */
+	ret += set_limit(&RLIMIT_SIGPENDING_SOFT, &RLIMIT_SIGPENDING_HARD, s,
+					 RLIMIT_SIGPENDING, 1);
 #endif
 
-    /* Handle RLIMIT_STACK */
-    ret += set_limit(&RLIMIT_STACK_SOFT, &RLIMIT_STACK_HARD, s, RLIMIT_STACK,
-		     1024);
-
-    /* make sure every rlimit suceeded */
-    if (ret != 0)
-	return (FALSE);
+	/* Handle RLIMIT_STACK */
+	ret += set_limit(&RLIMIT_STACK_SOFT, &RLIMIT_STACK_HARD, s, RLIMIT_STACK,
+					 1024);
+
+	/* make sure every rlimit suceeded */
+	if (ret != 0)
+		return (FALSE);
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    /* Add all options to initng */
-    initng_service_data_types_add(&RLIMIT_AS_SOFT);
-    initng_service_data_types_add(&RLIMIT_AS_HARD);
-    initng_service_data_types_add(&RLIMIT_CORE_SOFT);
-    initng_service_data_types_add(&RLIMIT_CORE_HARD);
-    initng_service_data_types_add(&RLIMIT_CPU_SOFT);
-    initng_service_data_types_add(&RLIMIT_CPU_HARD);
-    initng_service_data_types_add(&RLIMIT_DATA_SOFT);
-    initng_service_data_types_add(&RLIMIT_DATA_HARD);
-    initng_service_data_types_add(&RLIMIT_FSIZE_SOFT);
-    initng_service_data_types_add(&RLIMIT_FSIZE_HARD);
-    initng_service_data_types_add(&RLIMIT_MEMLOCK_SOFT);
-    initng_service_data_types_add(&RLIMIT_MEMLOCK_HARD);
-    initng_service_data_types_add(&RLIMIT_NOFILE_SOFT);
-    initng_service_data_types_add(&RLIMIT_NOFILE_HARD);
-    initng_service_data_types_add(&RLIMIT_NPROC_SOFT);
-    initng_service_data_types_add(&RLIMIT_NPROC_HARD);
-    initng_service_data_types_add(&RLIMIT_RSS_SOFT);
-    initng_service_data_types_add(&RLIMIT_RSS_HARD);
-    initng_service_data_types_add(&RLIMIT_SIGPENDING_SOFT);
-    initng_service_data_types_add(&RLIMIT_SIGPENDING_HARD);
-    initng_service_data_types_add(&RLIMIT_STACK_SOFT);
-    initng_service_data_types_add(&RLIMIT_STACK_HARD);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	/* Add all options to initng */
+	initng_service_data_types_add(&RLIMIT_AS_SOFT);
+	initng_service_data_types_add(&RLIMIT_AS_HARD);
+	initng_service_data_types_add(&RLIMIT_CORE_SOFT);
+	initng_service_data_types_add(&RLIMIT_CORE_HARD);
+	initng_service_data_types_add(&RLIMIT_CPU_SOFT);
+	initng_service_data_types_add(&RLIMIT_CPU_HARD);
+	initng_service_data_types_add(&RLIMIT_DATA_SOFT);
+	initng_service_data_types_add(&RLIMIT_DATA_HARD);
+	initng_service_data_types_add(&RLIMIT_FSIZE_SOFT);
+	initng_service_data_types_add(&RLIMIT_FSIZE_HARD);
+	initng_service_data_types_add(&RLIMIT_MEMLOCK_SOFT);
+	initng_service_data_types_add(&RLIMIT_MEMLOCK_HARD);
+	initng_service_data_types_add(&RLIMIT_NOFILE_SOFT);
+	initng_service_data_types_add(&RLIMIT_NOFILE_HARD);
+	initng_service_data_types_add(&RLIMIT_NPROC_SOFT);
+	initng_service_data_types_add(&RLIMIT_NPROC_HARD);
+	initng_service_data_types_add(&RLIMIT_RSS_SOFT);
+	initng_service_data_types_add(&RLIMIT_RSS_HARD);
+	initng_service_data_types_add(&RLIMIT_SIGPENDING_SOFT);
+	initng_service_data_types_add(&RLIMIT_SIGPENDING_HARD);
+	initng_service_data_types_add(&RLIMIT_STACK_SOFT);
+	initng_service_data_types_add(&RLIMIT_STACK_HARD);
 
-    /* add the after fork function hook */
-    initng_plugin_hook_add(&g.A_FORK, 20, &do_limit);
+	/* add the after fork function hook */
+	initng_plugin_hook_add(&g.A_FORK, 20, &do_limit);
 
-    /* always return happily */
-    return (TRUE);
+	/* always return happily */
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    /* remove the hook */
-    initng_plugin_hook_del(&g.A_FORK, &do_limit);
+	/* remove the hook */
+	initng_plugin_hook_del(&g.A_FORK, &do_limit);
 
-    /* Del all options to initng */
-    initng_service_data_types_del(&RLIMIT_AS_SOFT);
-    initng_service_data_types_del(&RLIMIT_AS_HARD);
-    initng_service_data_types_del(&RLIMIT_CORE_SOFT);
-    initng_service_data_types_del(&RLIMIT_CORE_HARD);
-    initng_service_data_types_del(&RLIMIT_CPU_SOFT);
-    initng_service_data_types_del(&RLIMIT_CPU_HARD);
-    initng_service_data_types_del(&RLIMIT_DATA_SOFT);
-    initng_service_data_types_del(&RLIMIT_DATA_HARD);
-    initng_service_data_types_del(&RLIMIT_FSIZE_SOFT);
-    initng_service_data_types_del(&RLIMIT_FSIZE_HARD);
-    initng_service_data_types_del(&RLIMIT_MEMLOCK_SOFT);
-    initng_service_data_types_del(&RLIMIT_MEMLOCK_HARD);
-    initng_service_data_types_del(&RLIMIT_NOFILE_SOFT);
-    initng_service_data_types_del(&RLIMIT_NOFILE_HARD);
-    initng_service_data_types_del(&RLIMIT_NPROC_SOFT);
-    initng_service_data_types_del(&RLIMIT_NPROC_HARD);
-    initng_service_data_types_del(&RLIMIT_RSS_SOFT);
-    initng_service_data_types_del(&RLIMIT_RSS_HARD);
-    initng_service_data_types_del(&RLIMIT_SIGPENDING_SOFT);
-    initng_service_data_types_del(&RLIMIT_SIGPENDING_HARD);
-    initng_service_data_types_del(&RLIMIT_STACK_SOFT);
-    initng_service_data_types_del(&RLIMIT_STACK_HARD);
+	/* Del all options to initng */
+	initng_service_data_types_del(&RLIMIT_AS_SOFT);
+	initng_service_data_types_del(&RLIMIT_AS_HARD);
+	initng_service_data_types_del(&RLIMIT_CORE_SOFT);
+	initng_service_data_types_del(&RLIMIT_CORE_HARD);
+	initng_service_data_types_del(&RLIMIT_CPU_SOFT);
+	initng_service_data_types_del(&RLIMIT_CPU_HARD);
+	initng_service_data_types_del(&RLIMIT_DATA_SOFT);
+	initng_service_data_types_del(&RLIMIT_DATA_HARD);
+	initng_service_data_types_del(&RLIMIT_FSIZE_SOFT);
+	initng_service_data_types_del(&RLIMIT_FSIZE_HARD);
+	initng_service_data_types_del(&RLIMIT_MEMLOCK_SOFT);
+	initng_service_data_types_del(&RLIMIT_MEMLOCK_HARD);
+	initng_service_data_types_del(&RLIMIT_NOFILE_SOFT);
+	initng_service_data_types_del(&RLIMIT_NOFILE_HARD);
+	initng_service_data_types_del(&RLIMIT_NPROC_SOFT);
+	initng_service_data_types_del(&RLIMIT_NPROC_HARD);
+	initng_service_data_types_del(&RLIMIT_RSS_SOFT);
+	initng_service_data_types_del(&RLIMIT_RSS_HARD);
+	initng_service_data_types_del(&RLIMIT_SIGPENDING_SOFT);
+	initng_service_data_types_del(&RLIMIT_SIGPENDING_HARD);
+	initng_service_data_types_del(&RLIMIT_STACK_SOFT);
+	initng_service_data_types_del(&RLIMIT_STACK_HARD);
 
 }

Modified: initng/trunk/plugins/lockfile/initng_lockfile.c
==============================================================================
--- initng/trunk/plugins/lockfile/initng_lockfile.c	(original)
+++ initng/trunk/plugins/lockfile/initng_lockfile.c	Wed Apr  5 23:11:19 2006
@@ -35,58 +35,58 @@
 #include <initng_static_service_types.h>
 
 s_entry LOCKFILE = { "lockfile", SET, NULL,
-    "If this option is set, plugin will create /var/lock/subsys/$NAME lockfile."
+	"If this option is set, plugin will create /var/lock/subsys/$NAME lockfile."
 };
 
 #define LOCKDIR "/var/lock/subsys/"
 
 static int status_change(active_db_h * service)
 {
-    D_("status change [%s]\n", service->name);
+	D_("status change [%s]\n", service->name);
 
-    // are we under influence of lockfile?
-    if (is(&LOCKFILE, service))
-    {
-	char *p = strrchr(service->name, '/') + 1;
-	char lockfile[sizeof(LOCKDIR) + strlen(p)];
-
-	strcpy(mempcpy(lockfile, LOCKDIR, sizeof(LOCKDIR) - 1), p);
-
-	D_("lockfile path [%s]\n", lockfile);
-	// service states from initng_is.h
-	if (IS_UP(service))
+	// are we under influence of lockfile?
+	if (is(&LOCKFILE, service))
 	{
-	    D_("service got up\n");
-	    creat(lockfile, S_IREAD);
+		char *p = strrchr(service->name, '/') + 1;
+		char lockfile[sizeof(LOCKDIR) + strlen(p)];
 
+		strcpy(mempcpy(lockfile, LOCKDIR, sizeof(LOCKDIR) - 1), p);
+
+		D_("lockfile path [%s]\n", lockfile);
+		// service states from initng_is.h
+		if (IS_UP(service))
+		{
+			D_("service got up\n");
+			creat(lockfile, S_IREAD);
+
+		}
+		else if (IS_DOWN(service))
+		{
+			D_("service went down\n");
+			unlink(lockfile);
+		}
 	}
-	else if (IS_DOWN(service))
-	{
-	    D_("service went down\n");
-	    unlink(lockfile);
-	}
-    }
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&LOCKFILE);
-    initng_plugin_hook_add(&g.IS_CHANGE, 50, &status_change);
-    return (TRUE);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&LOCKFILE);
+	initng_plugin_hook_add(&g.IS_CHANGE, 50, &status_change);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&LOCKFILE);
-    initng_plugin_hook_del(&g.IS_CHANGE, &status_change);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&LOCKFILE);
+	initng_plugin_hook_del(&g.IS_CHANGE, &status_change);
 }

Modified: initng/trunk/plugins/logfile/initng_logfile.c
==============================================================================
--- initng/trunk/plugins/logfile/initng_logfile.c	(original)
+++ initng/trunk/plugins/logfile/initng_logfile.c	Wed Apr  5 23:11:19 2006
@@ -22,7 +22,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
@@ -39,76 +39,76 @@
 
 
 static int program_output(active_db_h * service, process_h * x,
-			  char *buffer_pos)
+						  char *buffer_pos)
 {
-    const char *filename = NULL;
-    char *filename_fixed = NULL;
-    int len = 0;
-    int fd = -1;
-
-    assert(service);
-    assert(service->name);
-    assert(x);
-
-    D_("%s process fd: # %i, %i, service %s, have something to say\n",
-       x->pt->name, x->out_pipe[0], x->out_pipe[1], service->name);
-
-    /* get the filename */
-    filename = get_string(&LOGFILE, service);
-    if (!filename)
-    {
-	D_("Logfile not set\n");
-	return (FALSE);
-    }
-
-    /* Fix $variables in filename string */
-    filename_fixed = fix_variables(filename, service);
-
-    /* open the file */
-    fd = open(filename, O_WRONLY | O_CREAT | O_APPEND);
-    if (fd < 1)
-    {
-	F_("Error opening %s, err : %s\n", filename, strerror(errno));
-	return (FALSE);
-    }
-
-    /* Write data to logfile */
-    D_("Writing data...\n");
-    len = strlen(buffer_pos);
-
-    if (write(fd, buffer_pos, len) != len)
-	F_("Error writing to %s's log, err : %s\n", service->name,
-	   strerror(errno));
+	const char *filename = NULL;
+	char *filename_fixed = NULL;
+	int len = 0;
+	int fd = -1;
+
+	assert(service);
+	assert(service->name);
+	assert(x);
+
+	D_("%s process fd: # %i, %i, service %s, have something to say\n",
+	   x->pt->name, x->out_pipe[0], x->out_pipe[1], service->name);
+
+	/* get the filename */
+	filename = get_string(&LOGFILE, service);
+	if (!filename)
+	{
+		D_("Logfile not set\n");
+		return (FALSE);
+	}
+
+	/* Fix $variables in filename string */
+	filename_fixed = fix_variables(filename, service);
+
+	/* open the file */
+	fd = open(filename, O_WRONLY | O_CREAT | O_APPEND);
+	if (fd < 1)
+	{
+		F_("Error opening %s, err : %s\n", filename, strerror(errno));
+		return (FALSE);
+	}
+
+	/* Write data to logfile */
+	D_("Writing data...\n");
+	len = strlen(buffer_pos);
+
+	if (write(fd, buffer_pos, len) != len)
+		F_("Error writing to %s's log, err : %s\n", service->name,
+		   strerror(errno));
 
-    free(filename_fixed);
-    close(fd);
+	free(filename_fixed);
+	close(fd);
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    S_;
+	S_;
 
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&LOGFILE);
+	initng_service_data_types_add(&LOGFILE);
 
-    initng_plugin_hook_add(&g.PIPEWATCHERS, 30, &program_output);
-    return (TRUE);
+	initng_plugin_hook_add(&g.PIPEWATCHERS, 30, &program_output);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    S_;
+	S_;
 
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    initng_service_data_types_del(&LOGFILE);
+	initng_service_data_types_del(&LOGFILE);
 
-    initng_plugin_hook_del(&g.PIPEWATCHERS, &program_output);
+	initng_plugin_hook_del(&g.PIPEWATCHERS, &program_output);
 }

Modified: initng/trunk/plugins/netprobe/initng_netprobe.c
==============================================================================
--- initng/trunk/plugins/netprobe/initng_netprobe.c	(original)
+++ initng/trunk/plugins/netprobe/initng_netprobe.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -55,156 +55,156 @@
 
 static int is_network(void)
 {
-    struct ifconf ifc;
-    struct ifreq *ifr;
-    char buffert[1024];
-    int netsock = -1;
+	struct ifconf ifc;
+	struct ifreq *ifr;
+	char buffert[1024];
+	int netsock = -1;
 
 
-    netsock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
-    if (netsock < 0)
-    {
-	F_("Unable to open a socket!\n");
-	return (FALSE);
-    }
+	netsock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
+	if (netsock < 0)
+	{
+		F_("Unable to open a socket!\n");
+		return (FALSE);
+	}
 
-    ifc.ifc_len = sizeof(buffert);
-    ifc.ifc_buf = buffert;
+	ifc.ifc_len = sizeof(buffert);
+	ifc.ifc_buf = buffert;
 
-    if (ioctl(netsock, SIOCGIFCONF, &ifc) < 0)
-    {
-	F_("error: SIOCGIFCONF\n");
-	return (FALSE);
-    }
+	if (ioctl(netsock, SIOCGIFCONF, &ifc) < 0)
+	{
+		F_("error: SIOCGIFCONF\n");
+		return (FALSE);
+	}
 
-    /*printf("len:%i\n", ifc.ifc_len); */
+	/*printf("len:%i\n", ifc.ifc_len); */
 
 
-    ifr = ifc.ifc_req;
+	ifr = ifc.ifc_req;
 
-    {
-	int i;
-	for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; ifr++)
 	{
-	    /* Loopback is not network */
-	    if (strcmp("lo", ifr->ifr_name) == 0)
-		continue;
-	    /*struct ifreq i; */
-	    D_("found up interface %s.\n", ifr->ifr_name);
-	    close(netsock);
-	    network_status = TRUE;
-	    return (TRUE);
-	}
+		int i;
+		for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; ifr++)
+		{
+			/* Loopback is not network */
+			if (strcmp("lo", ifr->ifr_name) == 0)
+				continue;
+			/*struct ifreq i; */
+			D_("found up interface %s.\n", ifr->ifr_name);
+			close(netsock);
+			network_status = TRUE;
+			return (TRUE);
+		}
 
-    }
+	}
 
-    close(netsock);
-    network_status = FALSE;
-    return (FALSE);
+	close(netsock);
+	network_status = FALSE;
+	return (FALSE);
 }
 
 s_entry REQUIRE_NETWORK = { "require_network", SET, NULL,
-    "If set, initng will wait for an active Internet connection before starting this service."
+	"If set, initng will wait for an active Internet connection before starting this service."
 };
 s_entry NETWORK_PROVIDER = { "network_provider", SET, NULL,
-    "Set this on services that provides network, and it will be stopped after daemons have quit."
+	"Set this on services that provides network, and it will be stopped after daemons have quit."
 };
 
 
 static int check_STOP_DEP_MET(active_db_h * service)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* The network provider should always be stoppable */
-    if (is(&NETWORK_PROVIDER, service))
+	/* The network provider should always be stoppable */
+	if (is(&NETWORK_PROVIDER, service))
+		return (TRUE);
+
+	/*
+	 * if there exits any service with NETWORK_PROVIDER set,
+	 * and it is not down, continue waiting for STOP_DEP
+	 */
+	while_active_db(current)
+	{
+		if (is(&NETWORK_PROVIDER, service) && (!IS_DOWN(service)))
+			return (FALSE);
+	}
 	return (TRUE);
-
-    /*
-     * if there exits any service with NETWORK_PROVIDER set,
-     * and it is not down, continue waiting for STOP_DEP
-     */
-    while_active_db(current)
-    {
-	if (is(&NETWORK_PROVIDER, service) && (!IS_DOWN(service)))
-	    return (FALSE);
-    }
-    return (TRUE);
 }
 
 static int check_START_DEP_MET(active_db_h * service)
 {
-    /* only apply if service requires network */
-    if (!is(&REQUIRE_NETWORK, service))
-	return (TRUE);
-
-    D_("Doing check because REQURE_NETWORK is set.\n");
-
-    /*
-     * I believe that we are way better probing this in kernel, 
-     * then waiting for the net provider service to be up.
-     */
+	/* only apply if service requires network */
+	if (!is(&REQUIRE_NETWORK, service))
+		return (TRUE);
+
+	D_("Doing check because REQURE_NETWORK is set.\n");
+
+	/*
+	 * I believe that we are way better probing this in kernel, 
+	 * then waiting for the net provider service to be up.
+	 */
 #ifdef REQUIRE_NETWORK_PROVIDER_SERVICE_TO_BE_UP
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    while_active_db(current)
-    {
-	if (is(&NETWORK_PROVIDER, current) && IS_UP(current))
-	    goto ok;
-    }
-    /* Don't set sleep 1, because initng will be interrupted when a
-     * service changes state anyway.
-     */
-    /*initng_set_sleep(1); */
-    return (FALSE);
+	while_active_db(current)
+	{
+		if (is(&NETWORK_PROVIDER, current) && IS_UP(current))
+			goto ok;
+	}
+	/* Don't set sleep 1, because initng will be interrupted when a
+	 * service changes state anyway.
+	 */
+	/*initng_set_sleep(1); */
+	return (FALSE);
 
   ok:
 #endif
 
-    /*
-     * Now when we now that there is a network provider that
-     * is really up, we do an check with kernel network subsystem
-     * so we now this is true.
-     */
-
-    /* only do this check once every mainloop */
-    if (last_check != g.now.tv_sec)
-    {
-	network_status = is_network();
-	D_("Network status = %s\n",
-	   network_status == TRUE ? "TRUE" : "FALSE");
-    }
-    last_check = g.now.tv_sec;
+	/*
+	 * Now when we now that there is a network provider that
+	 * is really up, we do an check with kernel network subsystem
+	 * so we now this is true.
+	 */
 
-    if (network_status == TRUE)
-	return (TRUE);
+	/* only do this check once every mainloop */
+	if (last_check != g.now.tv_sec)
+	{
+		network_status = is_network();
+		D_("Network status = %s\n",
+		   network_status == TRUE ? "TRUE" : "FALSE");
+	}
+	last_check = g.now.tv_sec;
 
-    /* Make sure mainloop will run within 1 second. */
-    initng_global_set_sleep(1);
+	if (network_status == TRUE)
+		return (TRUE);
 
-    return (FALSE);
+	/* Make sure mainloop will run within 1 second. */
+	initng_global_set_sleep(1);
+
+	return (FALSE);
 }
 
 int module_init(int api_version)
 {
-    S_;
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	S_;
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&REQUIRE_NETWORK);
-    initng_service_data_types_add(&NETWORK_PROVIDER);
-    initng_plugin_hook_add(&g.START_DEP_MET, 55, &check_START_DEP_MET);
-    initng_plugin_hook_add(&g.STOP_DEP_MET, 55, &check_STOP_DEP_MET);
-    return (TRUE);
+	initng_service_data_types_add(&REQUIRE_NETWORK);
+	initng_service_data_types_add(&NETWORK_PROVIDER);
+	initng_plugin_hook_add(&g.START_DEP_MET, 55, &check_START_DEP_MET);
+	initng_plugin_hook_add(&g.STOP_DEP_MET, 55, &check_STOP_DEP_MET);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    S_;
-    initng_service_data_types_del(&REQUIRE_NETWORK);
-    initng_service_data_types_del(&NETWORK_PROVIDER);
-    initng_plugin_hook_del(&g.START_DEP_MET, &check_START_DEP_MET);
-    initng_plugin_hook_del(&g.STOP_DEP_MET, &check_STOP_DEP_MET);
+	S_;
+	initng_service_data_types_del(&REQUIRE_NETWORK);
+	initng_service_data_types_del(&NETWORK_PROVIDER);
+	initng_plugin_hook_del(&g.START_DEP_MET, &check_START_DEP_MET);
+	initng_plugin_hook_del(&g.STOP_DEP_MET, &check_STOP_DEP_MET);
 }

Modified: initng/trunk/plugins/ngc4/initng_ngc4.c
==============================================================================
--- initng/trunk/plugins/ngc4/initng_ngc4.c	(original)
+++ initng/trunk/plugins/ngc4/initng_ngc4.c	Wed Apr  5 23:11:19 2006
@@ -88,666 +88,666 @@
 /* Function to search for local commands, bound only to ngc4 */
 static s_command *lfbc(char cid)
 {
-    s_command *current = NULL;
+	s_command *current = NULL;
 
-    list_for_each_entry_prev(current, &local_commands_db.list, list)
-    {
-	if (current->command_id == cid)
-	    return (current);
-    }
-    return (NULL);
+	list_for_each_entry_prev(current, &local_commands_db.list, list)
+	{
+		if (current->command_id == cid)
+			return (current);
+	}
+	return (NULL);
 }
 
 static s_command *lfbs(char *name)
 {
-    s_command *current = NULL;
+	s_command *current = NULL;
 
-    list_for_each_entry_prev(current, &local_commands_db.list, list)
-    {
-	if (current->long_id && strcmp(current->long_id, name) == 0)
-	    return (current);
-    }
-    return (NULL);
+	list_for_each_entry_prev(current, &local_commands_db.list, list)
+	{
+		if (current->long_id && strcmp(current->long_id, name) == 0)
+			return (current);
+	}
+	return (NULL);
 }
 
 
 static void closesock(void)
 {
-    /* Check if we need to remove hooks */
-    if (fdh.fds < 0)
-	return;
-    D_("closesock %d\n", fdh.fds);
+	/* Check if we need to remove hooks */
+	if (fdh.fds < 0)
+		return;
+	D_("closesock %d\n", fdh.fds);
 
-    /* close socket and set to 0 */
-    close(fdh.fds);
-    fdh.fds = -1;
+	/* close socket and set to 0 */
+	close(fdh.fds);
+	fdh.fds = -1;
 }
 
 
 /* this is called on protocol_missmatch to reload initng if that plugin is present */
 static void initng_reload(void)
 {
-    s_command *reload;
+	s_command *reload;
 
 
-    /*
-     * Now we are going to try reload initng
-     * 
-     * ngc -c  is the reload command
-     */
-    reload = initng_command_find_by_command_id('c');
-    if (reload && reload->u.void_command_call)
-    {
-	/* call the reload call in that s_command */
-	(*reload->u.void_command_call) (NULL);
-    }
+	/*
+	 * Now we are going to try reload initng
+	 * 
+	 * ngc -c  is the reload command
+	 */
+	reload = initng_command_find_by_command_id('c');
+	if (reload && reload->u.void_command_call)
+	{
+		/* call the reload call in that s_command */
+		(*reload->u.void_command_call) (NULL);
+	}
 }
 
 static void handle_client(int fd)
 {
-    result_desc *result = NULL;
-    read_header header;
-    void *header_data = NULL;
-    ssize_t sent = 0;
-
-    s_command *tmp_cmd;		/* temporary storage for a command */
-
-    assert(fd > 0);
-
-    D_("handle_client(%i);\n", fd);
-
-    /* use file descriptor, because fread hangs here? */
-    if (TEMP_FAILURE_RETRY(recv(fd, &header, sizeof(read_header), 0)) <
-	(signed) sizeof(read_header))
-    {
-	F_("Could not read header.\n");
-	return;
-    }
+	result_desc *result = NULL;
+	read_header header;
+	void *header_data = NULL;
+	ssize_t sent = 0;
 
-    if (header.p_ver != PROTOCOL_4_VERSION)
-    {
-	F_("ngc protcol_version miss-match, server_protocol_version :%i, client_protocol_version :%i !\n Will try to hot-reload initng.", PROTOCOL_4_VERSION, header.p_ver);
-	initng_reload();
-	return;
-    }
+	s_command *tmp_cmd;			/* temporary storage for a command */
+
+	assert(fd > 0);
 
-    header.l[100] = '\0';
-    D_("command type '%c', long \"%s\", protocol_version %i\n", header.c,
-       header.l, header.p_ver);
-    if (header.body_len > 0)
-    {
-	D_("There is a body to read!\n");
-	header_data = i_calloc(1, header.body_len + 1);
-	if (!header_data)
+	D_("handle_client(%i);\n", fd);
+
+	/* use file descriptor, because fread hangs here? */
+	if (TEMP_FAILURE_RETRY(recv(fd, &header, sizeof(read_header), 0)) <
+		(signed) sizeof(read_header))
 	{
-	    F_("Could not allocate memory for header_data\n");
-	    return;
+		F_("Could not read header.\n");
+		return;
 	}
 
-	/* yost so ngc got a chance to fill header_data again */
-	usleep(10);
+	if (header.p_ver != PROTOCOL_4_VERSION)
+	{
+		F_("ngc protcol_version miss-match, server_protocol_version :%i, client_protocol_version :%i !\n Will try to hot-reload initng.", PROTOCOL_4_VERSION, header.p_ver);
+		initng_reload();
+		return;
+	}
 
-	if (TEMP_FAILURE_RETRY(recv(fd, header_data, header.body_len, 0)) <
-	    (signed) header.body_len)
+	header.l[100] = '\0';
+	D_("command type '%c', long \"%s\", protocol_version %i\n", header.c,
+	   header.l, header.p_ver);
+	if (header.body_len > 0)
 	{
-	    F_("Could not read header_data\n");
-	    if (header_data)
-		free(header_data);
-	    return;
+		D_("There is a body to read!\n");
+		header_data = i_calloc(1, header.body_len + 1);
+		if (!header_data)
+		{
+			F_("Could not allocate memory for header_data\n");
+			return;
+		}
+
+		/* yost so ngc got a chance to fill header_data again */
+		usleep(10);
+
+		if (TEMP_FAILURE_RETRY(recv(fd, header_data, header.body_len, 0)) <
+			(signed) header.body_len)
+		{
+			F_("Could not read header_data\n");
+			if (header_data)
+				free(header_data);
+			return;
+		}
 	}
-    }
 
-    /* allocate space for the result we will send */
-    result = i_calloc(1, sizeof(result_desc));
-    if (!result)
-	return;
+	/* allocate space for the result we will send */
+	result = i_calloc(1, sizeof(result_desc));
+	if (!result)
+		return;
+
+	/* set version */
+	strncpy(result->version, INITNG_VERSION, 100);
+	result->p_ver = PROTOCOL_4_VERSION;
 
-    /* set version */
-    strncpy(result->version, INITNG_VERSION, 100);
-    result->p_ver = PROTOCOL_4_VERSION;
-
-    /* ping check : */
-    if (header.c == 'X')
-    {
-	result->c = 'Y';
-	result->t = VOID_COMMAND;
-	result->s = S_TRUE;
-	result->payload = 0;
-	D_("Ping received, sending pong\n");
-	send(fd, result, sizeof(result_desc), 0);
-	if (header_data)
-	    free(header_data);
-	if (result)
-	    free(result);
-	return;
-    }
+	/* ping check : */
+	if (header.c == 'X')
+	{
+		result->c = 'Y';
+		result->t = VOID_COMMAND;
+		result->s = S_TRUE;
+		result->payload = 0;
+		D_("Ping received, sending pong\n");
+		send(fd, result, sizeof(result_desc), 0);
+		if (header_data)
+			free(header_data);
+		if (result)
+			free(result);
+		return;
+	}
 
-    /* Find the command requesting in the command database */
-    if (header.c)			    /* find by short opt */
-    {
-	/* first search in the local db */
-	tmp_cmd = lfbc(header.c);
-	if (!tmp_cmd)
-	    tmp_cmd = initng_command_find_by_command_id(header.c);
-    }
-    else if (header.l)			    /* find by long opt */
-    {
-	/* first search in the local db */
-	tmp_cmd = lfbs(header.l);
-	if (!tmp_cmd)
-	    tmp_cmd = initng_command_find_by_command_string(header.l);
-    }
-    else
-    {
-	if (header_data)
-	    free(header_data);
-	if (result)
-	    free(result);
-	return;
-    }
+	/* Find the command requesting in the command database */
+	if (header.c)							/* find by short opt */
+	{
+		/* first search in the local db */
+		tmp_cmd = lfbc(header.c);
+		if (!tmp_cmd)
+			tmp_cmd = initng_command_find_by_command_id(header.c);
+	}
+	else if (header.l)						/* find by long opt */
+	{
+		/* first search in the local db */
+		tmp_cmd = lfbs(header.l);
+		if (!tmp_cmd)
+			tmp_cmd = initng_command_find_by_command_string(header.l);
+	}
+	else
+	{
+		if (header_data)
+			free(header_data);
+		if (result)
+			free(result);
+		return;
+	}
 
-    /* Make sure the command we got is valid, else return an bad result */
-    if (!tmp_cmd || tmp_cmd->com_type == 0)
-    {
-	D_("command type '%c', long \"%s\"\n", header.c, header.l);
-	result->c = header.c;
-	result->t = COMMAND_FAIL;
-	result->payload = 0;
-	result->s = S_COMMAND_NOT_FOUND;
-	send(fd, result, sizeof(result_desc), 0);
+	/* Make sure the command we got is valid, else return an bad result */
+	if (!tmp_cmd || tmp_cmd->com_type == 0)
+	{
+		D_("command type '%c', long \"%s\"\n", header.c, header.l);
+		result->c = header.c;
+		result->t = COMMAND_FAIL;
+		result->payload = 0;
+		result->s = S_COMMAND_NOT_FOUND;
+		send(fd, result, sizeof(result_desc), 0);
+		if (header_data)
+			free(header_data);
+		if (result)
+			free(result);
+		return;
+	}
+
+	/* check if command requires option, and option is not set */
+	if (tmp_cmd->opt_type == REQUIRES_OPT && header.body_len < 1)
+	{
+		D_("Command %c - %s, requires an option!\n", header.c, header.l);
+		result->c = header.c;
+		result->t = COMMAND_FAIL;
+		result->payload = 0;
+		result->s = S_REQUIRES_OPT;
+		send(fd, result, sizeof(result_desc), 0);
+		if (header_data)
+			free(header_data);
+		return;
+	}
+
+	/* check if command is not using and option, and option is set */
+	if (tmp_cmd->opt_type == NO_OPT && header.body_len > 0)
+	{
+		D_("Command %c - %s, don't want an option!\n", header.c, header.l);
+		result->c = header.c;
+		result->t = COMMAND_FAIL;
+		result->payload = 0;
+		result->s = S_NOT_REQUIRES_OPT;
+		send(fd, result, sizeof(result_desc), 0);
+		if (header_data)
+			free(header_data);
+		return;
+	}
+
+	/* set the result statics. */
+	result->c = tmp_cmd->command_id;
+	result->t = tmp_cmd->com_type;
+
+	switch (tmp_cmd->com_type)
+	{
+
+		case TRUE_OR_FALSE_COMMAND:
+		case INT_COMMAND:
+			{
+				int ret = 0;
+
+				assert(tmp_cmd->u.int_command_call);
+				D_("Calling an int or true or false command.\n");
+
+				/* execute command */
+				ret = (int) (*tmp_cmd->u.
+							 int_command_call) ((char *) header_data);
+
+				/* Write a header respond */
+				result->s = S_TRUE;
+				result->payload = sizeof(int);
+
+				/* send the result */
+				if ((sent =
+					 send(fd, result, sizeof(result_desc),
+						  0)) != sizeof(result_desc))
+				{
+					F_("failed to send result, sent: %i of %i.\n", sent,
+					   sizeof(result_desc));
+					break;
+				}
+
+				/* send the payload */
+				if ((sent =
+					 send(fd, &ret, result->payload,
+						  0)) != (signed) result->payload)
+				{
+					F_("Could not send complete payload, sent %i of %i.",
+					   sent, result->payload);
+					break;
+				}
+				break;
+			}
+		case STRING_COMMAND:
+			{
+				char *send_buf = NULL;
+
+				assert(tmp_cmd->u.string_command_call);
+				D_("Calling an string command.\n");
+
+				/* execute command */
+				send_buf = (*tmp_cmd->u.
+							string_command_call) ((char *) header_data);
+				if (!send_buf)
+					break;
+
+				/* write an header respond */
+				result->s = S_TRUE;
+				result->payload = strlen(send_buf) * sizeof(char);
+
+				/* send the result */
+				if ((sent =
+					 send(fd, result, sizeof(result_desc),
+						  0)) != sizeof(result_desc))
+				{
+					F_("failed to send result, sent: %i of %i.\n", sent,
+					   sizeof(result_desc));
+					break;
+				}
+				/* send the payload */
+				if ((sent =
+					 send(fd, send_buf, result->payload,
+						  0)) != (signed) result->payload)
+				{
+					F_("Could not send complete payload, sent %i of %i.",
+					   sent, result->payload);
+					break;
+				}
+
+				/* free and clear */
+				free(send_buf);
+				break;
+			}
+		case VOID_COMMAND:
+			{
+				assert(tmp_cmd->u.void_command_call);
+				D_("Calling a void command!\n");
+
+				/* execute command */
+				(*tmp_cmd->u.void_command_call) ((char *) header_data);
+
+				/* write an header respond */
+				result->s = S_TRUE;
+				result->payload = 0;		/* unknown payload size here, TODO FIX THIS */
+
+				/* sent result */
+				if ((sent =
+					 send(fd, result, sizeof(result_desc),
+						  0)) != sizeof(result_desc))
+				{
+					F_("failed to send result, sent: %i of %i.\n", sent,
+					   sizeof(result_desc));
+					break;
+				}
+				break;
+			}
+		case PAYLOAD_COMMAND:
+		case DATA_COMMANDS_ROW:
+		case DATA_ACTIVE_ROW:
+		case DATA_OPTION_ROW:
+			{
+				/* iniziate a data payload variable */
+				s_payload payload;
+
+				/* clear payload */
+				memset(&payload, 0, sizeof(s_payload));
+
+				assert(tmp_cmd->u.data_command_call);
+				D_("Calling an data_command.\n");
+
+				/* execute command */
+				(*tmp_cmd->u.data_command_call) ((char *) header_data,
+												 &payload);
+
+
+				/* write an header respond */
+				result->s = S_TRUE;
+				result->payload = payload.s;
+
+				/* send the result */
+				if ((sent =
+					 send(fd, result, sizeof(result_desc),
+						  0)) != sizeof(result_desc))
+				{
+					F_("failed to send result, sent: %i of %i.\n", sent,
+					   sizeof(result_desc));
+					break;
+				}
+
+				/* with out this, the client wont get the 2ond send. WHY? */
+				usleep(1);
+
+				/* send the payload */
+				D_("Sending a payload of %i bytes.\n", result->payload);
+				if ((sent =
+					 send(fd, payload.p, result->payload,
+						  0)) != (signed) result->payload)
+				{
+					F_("Could not send complete payload, sent %i of %i.",
+					   sent, result->payload);
+					break;
+				}
+
+				/* cleanup and free */
+				free(payload.p);
+				break;
+			}
+		case COMMAND_FAIL:
+
+			/* return FAIL header respond */
+			result->s = S_INVALID_TYPE;
+			if ((sent =
+				 send(fd, result, sizeof(result_desc),
+					  0)) != (signed) sizeof(result_desc))
+			{
+				F_("failed to send result, sent: %i of %i.\n", sent,
+				   sizeof(result_desc));
+				break;
+			}
+			/* TODO: really continue?? */
+
+			D_("Invalid command type '%c', line '%s'\n", header.c, header.l);
+			if (header_data)
+				free(header_data);
+			return;
+	}
+	D_("Returned successfully.\n");
 	if (header_data)
-	    free(header_data);
+		free(header_data);
 	if (result)
-	    free(result);
+		free(result);
 	return;
-    }
+}
 
-    /* check if command requires option, and option is not set */
-    if (tmp_cmd->opt_type == REQUIRES_OPT && header.body_len < 1)
-    {
-	D_("Command %c - %s, requires an option!\n", header.c, header.l);
-	result->c = header.c;
-	result->t = COMMAND_FAIL;
-	result->payload = 0;
-	result->s = S_REQUIRES_OPT;
-	send(fd, result, sizeof(result_desc), 0);
-	if (header_data)
-	    free(header_data);
-	return;
-    }
 
-    /* check if command is not using and option, and option is set */
-    if (tmp_cmd->opt_type == NO_OPT && header.body_len > 0)
-    {
-	D_("Command %c - %s, don't want an option!\n", header.c, header.l);
-	result->c = header.c;
-	result->t = COMMAND_FAIL;
-	result->payload = 0;
-	result->s = S_NOT_REQUIRES_OPT;
-	send(fd, result, sizeof(result_desc), 0);
-	if (header_data)
-	    free(header_data);
-	return;
-    }
+/* called by fd hook, when data is no socket */
+void accepted_client(f_module_h * from, e_fdw what)
+{
+	int newsock;
 
-    /* set the result statics. */
-    result->c = tmp_cmd->command_id;
-    result->t = tmp_cmd->com_type;
+	/* make a dumb check */
+	if (from != &fdh)
+		return;
+
+	D_("Got here from fd hook.\n");
+	/* we try to fix socket after every service start
+	   if it fails here chances are a user screwed it
+	   up, and we shouldn't manually try to fix anything. */
+	if (fdh.fds <= 0)
+	{
+		/* socket is invalid but we were called, call closesocket to make sure it wont happen again */
+		F_("accepted client called with fdh.fds %d, report bug\n", fdh.fds);
+		closesock();
+		F_("Attempting to reopen socket\n");
+		open_socket();
+		return;
+	}
 
-    switch (tmp_cmd->com_type)
-    {
+	/* create a new socket, for reading */
+	if ((newsock = accept(fdh.fds, NULL, NULL)) > 0)
+	{
+		/*file_sock = fdopen(newsock, "r+");
+		   D_("read socket open, now reading\n"); */
 
-	case TRUE_OR_FALSE_COMMAND:
-	case INT_COMMAND:
-	    {
-		int ret = 0;
+		/* read the data, by the handle_client function */
+		handle_client(newsock);
 
-		assert(tmp_cmd->u.int_command_call);
-		D_("Calling an int or true or false command.\n");
+		/*close(newsock); */
+		/*  clean up, and return
+		   fclose(file_sock); */
+		D_("Success!\n");
+		return;
+	}
 
-		/* execute command */
-		ret = (int) (*tmp_cmd->u.
-			     int_command_call) ((char *) header_data);
+	/* temporary unavailable */
+	if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
+	{
+		W_("errno = EAGAIN!\n");
+		return;
+	}
 
-		/* Write a header respond */
-		result->s = S_TRUE;
-		result->payload = sizeof(int);
+	/* This'll generally happen on shutdown, don't cry about it. */
+	D_("Error accepting socket %d, %s\n", fdh.fds, strerror(errno));
+	closesock();
+	return;
+}
 
-		/* send the result */
-		if ((sent =
-		     send(fd, result, sizeof(result_desc),
-			  0)) != sizeof(result_desc))
-		{
-		    F_("failed to send result, sent: %i of %i.\n", sent,
-		       sizeof(result_desc));
-		    break;
-		}
+/* Send a ping to ourselves to check if we're 100% ok. */
+static int sendping()
+{
+	int client;
+	struct sockaddr_un sockname;
+	read_header header;
+	result_desc result;
 
-		/* send the payload */
-		if ((sent =
-		     send(fd, &ret, result->payload,
-			  0)) != (signed) result->payload)
-		{
-		    F_("Could not send complete payload, sent %i of %i.",
-		       sent, result->payload);
-		    break;
-		}
-		break;
-	    }
-	case STRING_COMMAND:
-	    {
-		char *send_buf = NULL;
-
-		assert(tmp_cmd->u.string_command_call);
-		D_("Calling an string command.\n");
-
-		/* execute command */
-		send_buf = (*tmp_cmd->u.
-			    string_command_call) ((char *) header_data);
-		if (!send_buf)
-		    break;
 
-		/* write an header respond */
-		result->s = S_TRUE;
-		result->payload = strlen(send_buf) * sizeof(char);
+	D_("Sending ping\n");
 
-		/* send the result */
-		if ((sent =
-		     send(fd, result, sizeof(result_desc),
-			  0)) != sizeof(result_desc))
-		{
-		    F_("failed to send result, sent: %i of %i.\n", sent,
-		       sizeof(result_desc));
-		    break;
-		}
-		/* send the payload */
-		if ((sent =
-		     send(fd, send_buf, result->payload,
-			  0)) != (signed) result->payload)
-		{
-		    F_("Could not send complete payload, sent %i of %i.",
-		       sent, result->payload);
-		    break;
-		}
+	memset(&header, 0, sizeof(read_header));
+	header.p_ver = PROTOCOL_4_VERSION;
 
-		/* free and clear */
-		free(send_buf);
-		break;
-	    }
-	case VOID_COMMAND:
-	    {
-		assert(tmp_cmd->u.void_command_call);
-		D_("Calling a void command!\n");
+	/* Create the socket. */
+	client = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (client < 0)
+	{
+		F_("Failed to init socket\n");
+		return FALSE;
+	}
 
-		/* execute command */
-		(*tmp_cmd->u.void_command_call) ((char *) header_data);
+	/* Bind a name to the socket. */
+	sockname.sun_family = AF_UNIX;
 
-		/* write an header respond */
-		result->s = S_TRUE;
-		result->payload = 0;	    /* unknown payload size here, TODO FIX THIS */
+	strcpy(sockname.sun_path, socket_filename);
 
-		/* sent result */
-		if ((sent =
-		     send(fd, result, sizeof(result_desc),
-			  0)) != sizeof(result_desc))
-		{
-		    F_("failed to send result, sent: %i of %i.\n", sent,
-		       sizeof(result_desc));
-		    break;
-		}
-		break;
-	    }
-	case PAYLOAD_COMMAND:
-	case DATA_COMMANDS_ROW:
-	case DATA_ACTIVE_ROW:
-	case DATA_OPTION_ROW:
-	    {
-		/* iniziate a data payload variable */
-		s_payload payload;
-
-		/* clear payload */
-		memset(&payload, 0, sizeof(s_payload));
-
-		assert(tmp_cmd->u.data_command_call);
-		D_("Calling an data_command.\n");
-
-		/* execute command */
-		(*tmp_cmd->u.data_command_call) ((char *) header_data,
-						 &payload);
+	/* Try to connect */
+	if (connect
+		(client, (struct sockaddr *) &sockname,
+		 (strlen(sockname.sun_path) + sizeof(sockname.sun_family))) < 0)
+	{
+		close(client);
+		return FALSE;
+	}
 
+	/* Write X to ping ourselves */
 
-		/* write an header respond */
-		result->s = S_TRUE;
-		result->payload = payload.s;
+	header.c = 'X';
+	header.l[0] = '\0';
 
-		/* send the result */
-		if ((sent =
-		     send(fd, result, sizeof(result_desc),
-			  0)) != sizeof(result_desc))
-		{
-		    F_("failed to send result, sent: %i of %i.\n", sent,
-		       sizeof(result_desc));
-		    break;
-		}
+	D_("Sending PING..\n");
+	if (write(client, &header, sizeof(read_header)) <
+		(signed) sizeof(read_header))
+	{
+		F_("Unable to send PING!\n");
+		close(client);
+		return (FALSE);
+	}
+	D_("PING sent..\n");
 
-		/* with out this, the client wont get the 2ond send. WHY? */
-		usleep(1);
+	/* Accept "server side" */
+	accepted_client(&fdh, FDW_READ);
 
-		/* send the payload */
-		D_("Sending a payload of %i bytes.\n", result->payload);
-		if ((sent =
-		     send(fd, payload.p, result->payload,
-			  0)) != (signed) result->payload)
-		{
-		    F_("Could not send complete payload, sent %i of %i.",
-		       sent, result->payload);
-		    break;
-		}
+	D_("Reading PONG..\n");
+	if ((read(client, &result, sizeof(result_desc)) <
+		 (signed) sizeof(result_desc)) || result.c != 'Y'
+		|| result.s != S_TRUE)
+	{
+		F_("Unable to receive PONG!\n");
+		close(client);
+		return (FALSE);
+	}
 
-		/* cleanup and free */
-		free(payload.p);
-		break;
-	    }
-	case COMMAND_FAIL:
-
-	    /* return FAIL header respond */
-	    result->s = S_INVALID_TYPE;
-	    if ((sent =
-		 send(fd, result, sizeof(result_desc),
-		      0)) != (signed) sizeof(result_desc))
-	    {
-		F_("failed to send result, sent: %i of %i.\n", sent,
-		   sizeof(result_desc));
-		break;
-	    }
-	    /* TODO: really continue?? */
+	D_("Got pong\n");
 
-	    D_("Invalid command type '%c', line '%s'\n", header.c, header.l);
-	    if (header_data)
-		free(header_data);
-	    return;
-    }
-    D_("Returned successfully.\n");
-    if (header_data)
-	free(header_data);
-    if (result)
-	free(result);
-    return;
+	return TRUE;
 }
 
-
-/* called by fd hook, when data is no socket */
-void accepted_client(f_module_h * from, e_fdw what)
+/* this will try to open a new socket */
+static int open_socket()
 {
-    int newsock;
+	/*    int flags; */
+	struct sockaddr_un serv_sockname;
 
-    /* make a dumb check */
-    if (from != &fdh)
-	return;
+	D_("Creating " SOCKET_4_ROOTPATH " dir\n");
 
-    D_("Got here from fd hook.\n");
-    /* we try to fix socket after every service start
-       if it fails here chances are a user screwed it
-       up, and we shouldn't manually try to fix anything. */
-    if (fdh.fds <= 0)
-    {
-	/* socket is invalid but we were called, call closesocket to make sure it wont happen again */
-	F_("accepted client called with fdh.fds %d, report bug\n", fdh.fds);
 	closesock();
-	F_("Attempting to reopen socket\n");
-	open_socket();
-	return;
-    }
-
-    /* create a new socket, for reading */
-    if ((newsock = accept(fdh.fds, NULL, NULL)) > 0)
-    {
-	/*file_sock = fdopen(newsock, "r+");
-	   D_("read socket open, now reading\n"); */
-
-	/* read the data, by the handle_client function */
-	handle_client(newsock);
-
-	/*close(newsock); */
-	/*  clean up, and return
-	   fclose(file_sock); */
-	D_("Success!\n");
-	return;
-    }
 
-    /* temporary unavailable */
-    if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
-    {
-	W_("errno = EAGAIN!\n");
-	return;
-    }
-
-    /* This'll generally happen on shutdown, don't cry about it. */
-    D_("Error accepting socket %d, %s\n", fdh.fds, strerror(errno));
-    closesock();
-    return;
-}
+	/* Make /dev/initng if it doesn't exist (try either way) */
+	if (mkdir(SOCKET_4_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1
+		&& errno != EEXIST)
+	{
+		if (errno != EROFS)
+			F_("Could not create " SOCKET_4_ROOTPATH
+			   " : %s, may be / fs not mounted read-write yet?, will retry until I succeed.\n",
+			   strerror(errno));
+		return (FALSE);
+	}
 
-/* Send a ping to ourselves to check if we're 100% ok. */
-static int sendping()
-{
-    int client;
-    struct sockaddr_un sockname;
-    read_header header;
-    result_desc result;
-
-
-    D_("Sending ping\n");
-
-    memset(&header, 0, sizeof(read_header));
-    header.p_ver = PROTOCOL_4_VERSION;
-
-    /* Create the socket. */
-    client = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (client < 0)
-    {
-	F_("Failed to init socket\n");
-	return FALSE;
-    }
-
-    /* Bind a name to the socket. */
-    sockname.sun_family = AF_UNIX;
-
-    strcpy(sockname.sun_path, socket_filename);
-
-    /* Try to connect */
-    if (connect
-	(client, (struct sockaddr *) &sockname,
-	 (strlen(sockname.sun_path) + sizeof(sockname.sun_family))) < 0)
-    {
-	close(client);
-	return FALSE;
-    }
-
-    /* Write X to ping ourselves */
-
-    header.c = 'X';
-    header.l[0] = '\0';
-
-    D_("Sending PING..\n");
-    if (write(client, &header, sizeof(read_header)) <
-	(signed) sizeof(read_header))
-    {
-	F_("Unable to send PING!\n");
-	close(client);
-	return (FALSE);
-    }
-    D_("PING sent..\n");
-
-    /* Accept "server side" */
-    accepted_client(&fdh, FDW_READ);
-
-    D_("Reading PONG..\n");
-    if ((read(client, &result, sizeof(result_desc)) <
-	 (signed) sizeof(result_desc)) || result.c != 'Y'
-	|| result.s != S_TRUE)
-    {
-	F_("Unable to receive PONG!\n");
-	close(client);
-	return (FALSE);
-    }
+	/* chmod root path for root use only */
+	if (chmod(SOCKET_4_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
+	{
+		/* path doesn't exist, we don't have /dev yet. */
+		if (errno == ENOENT || errno == EROFS)
+			return (FALSE);
 
-    D_("Got pong\n");
+		F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
+		   SOCKET_4_ROOTPATH);
+	}
 
-    return TRUE;
-}
+	/* Create the socket. */
+	fdh.fds = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (fdh.fds < 1)
+	{
+		F_("Failed to init socket (%s)\n", strerror(errno));
+		fdh.fds = -1;
+		return (FALSE);
+	}
 
-/* this will try to open a new socket */
-static int open_socket()
-{
-    /*    int flags; */
-    struct sockaddr_un serv_sockname;
+	/* Set socket to non blocking mode */
+	/*    flags = fcntl(fdh.fds, F_GETFL);
+	   if (flags < 0)
+	   {
+	   F_("Failed to fcntl fdh.fds\n");
+	   closesock();
+	   return (FALSE);
+	   }
+	   flags |= O_NONBLOCK;
+	   if (fcntl(fdh.fds, F_SETFL, flags) < 0)
+	   {
+	   F_("Failed to set fdh.fds O_NONBLOCK\n");
+	   closesock();
+	   return (FALSE);
+	   } */
 
-    D_("Creating " SOCKET_4_ROOTPATH " dir\n");
 
-    closesock();
+	/* Bind a name to the socket. */
+	serv_sockname.sun_family = AF_UNIX;
 
-    /* Make /dev/initng if it doesn't exist (try either way) */
-    if (mkdir(SOCKET_4_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1
-	&& errno != EEXIST)
-    {
-	if (errno != EROFS)
-	    F_("Could not create " SOCKET_4_ROOTPATH
-	       " : %s, may be / fs not mounted read-write yet?, will retry until I succeed.\n",
-	       strerror(errno));
-	return (FALSE);
-    }
-
-    /* chmod root path for root use only */
-    if (chmod(SOCKET_4_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
-    {
-	/* path doesn't exist, we don't have /dev yet. */
-	if (errno == ENOENT || errno == EROFS)
-	    return (FALSE);
-
-	F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
-	   SOCKET_4_ROOTPATH);
-    }
-
-    /* Create the socket. */
-    fdh.fds = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (fdh.fds < 1)
-    {
-	F_("Failed to init socket (%s)\n", strerror(errno));
-	fdh.fds = -1;
-	return (FALSE);
-    }
+	strcpy(serv_sockname.sun_path, socket_filename);
 
-    /* Set socket to non blocking mode */
-    /*    flags = fcntl(fdh.fds, F_GETFL);
-       if (flags < 0)
-       {
-       F_("Failed to fcntl fdh.fds\n");
-       closesock();
-       return (FALSE);
-       }
-       flags |= O_NONBLOCK;
-       if (fcntl(fdh.fds, F_SETFL, flags) < 0)
-       {
-       F_("Failed to set fdh.fds O_NONBLOCK\n");
-       closesock();
-       return (FALSE);
-       } */
-
-
-    /* Bind a name to the socket. */
-    serv_sockname.sun_family = AF_UNIX;
-
-    strcpy(serv_sockname.sun_path, socket_filename);
-
-    /* Remove old socket file if any */
-    unlink(serv_sockname.sun_path);
-
-    /* Try to bind */
-    if (bind
-	(fdh.fds, (struct sockaddr *) &serv_sockname,
-	 (strlen(serv_sockname.sun_path) +
-	  sizeof(serv_sockname.sun_family))) < 0)
-    {
-	F_("Error binding to socket (errno: %d str: '%s')\n", errno,
-	   strerror(errno));
-	closesock();
+	/* Remove old socket file if any */
 	unlink(serv_sockname.sun_path);
-	return (FALSE);
-    }
 
-    /* chmod socket for root only use */
-    if (chmod(serv_sockname.sun_path, S_IRUSR | S_IWUSR) == -1)
-    {
-	F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
-	   serv_sockname.sun_path);
-	closesock();
-	return (FALSE);
-    }
+	/* Try to bind */
+	if (bind
+		(fdh.fds, (struct sockaddr *) &serv_sockname,
+		 (strlen(serv_sockname.sun_path) +
+		  sizeof(serv_sockname.sun_family))) < 0)
+	{
+		F_("Error binding to socket (errno: %d str: '%s')\n", errno,
+		   strerror(errno));
+		closesock();
+		unlink(serv_sockname.sun_path);
+		return (FALSE);
+	}
 
-    /* store sock_stat for checking if we need to recreate socket later */
-    stat(serv_sockname.sun_path, &sock_stat);
+	/* chmod socket for root only use */
+	if (chmod(serv_sockname.sun_path, S_IRUSR | S_IWUSR) == -1)
+	{
+		F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
+		   serv_sockname.sun_path);
+		closesock();
+		return (FALSE);
+	}
 
-    /* Listen to socket */
-    if (listen(fdh.fds, 5))
-    {
-	F_("Error on listen (errno: %d str: '%s')\n", errno, strerror(errno));
-	closesock();
-	unlink(serv_sockname.sun_path);
-	return (FALSE);
-    }
+	/* store sock_stat for checking if we need to recreate socket later */
+	stat(serv_sockname.sun_path, &sock_stat);
 
+	/* Listen to socket */
+	if (listen(fdh.fds, 5))
+	{
+		F_("Error on listen (errno: %d str: '%s')\n", errno, strerror(errno));
+		closesock();
+		unlink(serv_sockname.sun_path);
+		return (FALSE);
+	}
 
 
-    /* Run check : */
-    if (!sendping())
-    {
-	F_("Sendping check failed, ngc2 communication not available (if you see this open a bug)\n");
-	closesock();
-	return (FALSE);
-    }
 
-    return (TRUE);
+	/* Run check : */
+	if (!sendping())
+	{
+		F_("Sendping check failed, ngc2 communication not available (if you see this open a bug)\n");
+		closesock();
+		return (FALSE);
+	}
+
+	return (TRUE);
 }
 
 /* this will check socket, and reopen on failure */
 static void check_socket(int signal)
 {
-    struct stat st;
+	struct stat st;
 
-    if (signal != SIGHUP)
-	return;
+	if (signal != SIGHUP)
+		return;
 
-    D_("Checking socket\n");
+	D_("Checking socket\n");
 
-    /* Check if socket needs reopening */
-    if (fdh.fds <= 0)
-    {
-	D_("fdh.fds not set, opening new socket.\n");
-	open_socket();
-	return;
-    }
+	/* Check if socket needs reopening */
+	if (fdh.fds <= 0)
+	{
+		D_("fdh.fds not set, opening new socket.\n");
+		open_socket();
+		return;
+	}
 
-    /* stat the socket, reopen on failure */
-    memset(&st, 0, sizeof(st));
-    if (stat(socket_filename, &st) < 0)
-    {
-	W_("Stat failed! Opening new socket.\n");
-	open_socket();
-	return;
-    }
+	/* stat the socket, reopen on failure */
+	memset(&st, 0, sizeof(st));
+	if (stat(socket_filename, &st) < 0)
+	{
+		W_("Stat failed! Opening new socket.\n");
+		open_socket();
+		return;
+	}
 
-    /* compare socket file, with the one that we know, reopen on failure */
-    if (st.st_dev != sock_stat.st_dev || st.st_ino != sock_stat.st_ino
-	|| st.st_mtime != sock_stat.st_mtime)
-    {
-	F_("Invalid socket found, reopening\n");
-	open_socket();
-	return;
-    }
+	/* compare socket file, with the one that we know, reopen on failure */
+	if (st.st_dev != sock_stat.st_dev || st.st_ino != sock_stat.st_ino
+		|| st.st_mtime != sock_stat.st_mtime)
+	{
+		F_("Invalid socket found, reopening\n");
+		open_socket();
+		return;
+	}
 
-    D_("Socket ok.\n");
-    return;
+	D_("Socket ok.\n");
+	return;
 }
 
 
@@ -757,392 +757,392 @@
 
 static void cmd_help(char *arg, s_payload * payload)
 {
-    s_command *current = NULL;
-    int i = 0;
+	s_command *current = NULL;
+	int i = 0;
 
-    (void) arg;
-    payload->p = (help_row *) i_calloc(101, sizeof(help_row));
-    memset(payload->p, 0, sizeof(help_row) * 100);
-
-    list_for_each_entry_prev(current, &local_commands_db.list, list)
-    {
-	help_row *row = payload->p + (i * sizeof(help_row));
-
-	if (current->opt_vissible != STANDARD_COMMAND)
-	    continue;
-
-	row->c = current->command_id;
-	row->t = current->com_type;
-	row->o = current->opt_type;
-
-	/* copy description */
-	if (current->description)
-	    strncpy(row->d, current->description, 200);
-	else
-	    row->d[0] = '\0';
+	(void) arg;
+	payload->p = (help_row *) i_calloc(101, sizeof(help_row));
+	memset(payload->p, 0, sizeof(help_row) * 100);
 
-	/* copy long id */
-	if (current->long_id)
-	    strncpy(row->l, current->long_id, 100);
-	else
-	    row->l[0] = '\0';
+	list_for_each_entry_prev(current, &local_commands_db.list, list)
+	{
+		help_row *row = payload->p + (i * sizeof(help_row));
 
-	i++;
-    }
-    current = NULL;
-    while_command_db(current)
-    {
-	help_row *row = payload->p + (i * sizeof(help_row));
-
-	if (current->opt_vissible != STANDARD_COMMAND)
-	    continue;
-
-	row->c = current->command_id;
-	row->t = current->com_type;
-	row->o = current->opt_type;
-
-	/* copy description */
-	if (current->description)
-	    strncpy(row->d, current->description, 200);
-	else
-	    row->d[0] = '\0';
+		if (current->opt_vissible != STANDARD_COMMAND)
+			continue;
 
-	/* copy long id */
-	if (current->long_id)
-	    strncpy(row->l, current->long_id, 100);
-	else
-	    row->l[0] = '\0';
+		row->c = current->command_id;
+		row->t = current->com_type;
+		row->o = current->opt_type;
+
+		/* copy description */
+		if (current->description)
+			strncpy(row->d, current->description, 200);
+		else
+			row->d[0] = '\0';
+
+		/* copy long id */
+		if (current->long_id)
+			strncpy(row->l, current->long_id, 100);
+		else
+			row->l[0] = '\0';
 
-	i++;
-    }
+		i++;
+	}
+	current = NULL;
+	while_command_db(current)
+	{
+		help_row *row = payload->p + (i * sizeof(help_row));
+
+		if (current->opt_vissible != STANDARD_COMMAND)
+			continue;
+
+		row->c = current->command_id;
+		row->t = current->com_type;
+		row->o = current->opt_type;
+
+		/* copy description */
+		if (current->description)
+			strncpy(row->d, current->description, 200);
+		else
+			row->d[0] = '\0';
+
+		/* copy long id */
+		if (current->long_id)
+			strncpy(row->l, current->long_id, 100);
+		else
+			row->l[0] = '\0';
 
-    /* set up the payload info */
-    payload->s = i * sizeof(help_row);
+		i++;
+	}
+
+	/* set up the payload info */
+	payload->s = i * sizeof(help_row);
 }
 
 static void cmd_help_all(char *arg, s_payload * payload)
 {
-    int i = 0;
-    s_command *current = NULL;
+	int i = 0;
+	s_command *current = NULL;
 
-    (void) arg;
+	(void) arg;
 
 
-    /* allocate space for payload, static malloc for now */
-    payload->p = (help_row *) i_calloc(101, sizeof(help_row));
-    memset(payload->p, 0, sizeof(help_row) * 100);
-
-    list_for_each_entry_prev(current, &local_commands_db.list, list)
-    {
-	help_row *row = payload->p + (i * sizeof(help_row));
-
-	if (current->opt_vissible != STANDARD_COMMAND
-	    && current->opt_vissible != ADVANCHED_COMMAND)
-	    continue;
-
-	row->c = current->command_id;
-	row->t = current->com_type;
-	row->o = current->opt_type;
-	/* copy description */
-	if (current->description)
-	    strncpy(row->d, current->description, 200);
-	else
-	    row->d[0] = '\0';
+	/* allocate space for payload, static malloc for now */
+	payload->p = (help_row *) i_calloc(101, sizeof(help_row));
+	memset(payload->p, 0, sizeof(help_row) * 100);
 
-	/* copy long id */
-	if (current->long_id)
-	    strncpy(row->l, current->long_id, 100);
-	else
-	    row->l[0] = '\0';
-	i++;
-    }
-
-    current = NULL;
-    while_command_db(current)
-    {
-	help_row *row = payload->p + (i * sizeof(help_row));
-
-	if (current->opt_vissible != STANDARD_COMMAND
-	    && current->opt_vissible != ADVANCHED_COMMAND)
-	    continue;
-
-	row->c = current->command_id;
-	row->t = current->com_type;
-	row->o = current->opt_type;
-	/* copy description */
-	if (current->description)
-	    strncpy(row->d, current->description, 200);
-	else
-	    row->d[0] = '\0';
+	list_for_each_entry_prev(current, &local_commands_db.list, list)
+	{
+		help_row *row = payload->p + (i * sizeof(help_row));
 
-	/* copy long id */
-	if (current->long_id)
-	    strncpy(row->l, current->long_id, 100);
-	else
-	    row->l[0] = '\0';
-	i++;
-    }
+		if (current->opt_vissible != STANDARD_COMMAND
+			&& current->opt_vissible != ADVANCHED_COMMAND)
+			continue;
+
+		row->c = current->command_id;
+		row->t = current->com_type;
+		row->o = current->opt_type;
+		/* copy description */
+		if (current->description)
+			strncpy(row->d, current->description, 200);
+		else
+			row->d[0] = '\0';
+
+		/* copy long id */
+		if (current->long_id)
+			strncpy(row->l, current->long_id, 100);
+		else
+			row->l[0] = '\0';
+		i++;
+	}
 
-    /* set up the payload info */
-    payload->s = i * sizeof(help_row);
+	current = NULL;
+	while_command_db(current)
+	{
+		help_row *row = payload->p + (i * sizeof(help_row));
+
+		if (current->opt_vissible != STANDARD_COMMAND
+			&& current->opt_vissible != ADVANCHED_COMMAND)
+			continue;
+
+		row->c = current->command_id;
+		row->t = current->com_type;
+		row->o = current->opt_type;
+		/* copy description */
+		if (current->description)
+			strncpy(row->d, current->description, 200);
+		else
+			row->d[0] = '\0';
+
+		/* copy long id */
+		if (current->long_id)
+			strncpy(row->l, current->long_id, 100);
+		else
+			row->l[0] = '\0';
+		i++;
+	}
+
+	/* set up the payload info */
+	payload->s = i * sizeof(help_row);
 }
 
 static void cmd_start(char *arg, s_payload * payload)
 {
-    active_db_h *serv = NULL;
+	active_db_h *serv = NULL;
 
-    payload->p = (active_row *) i_calloc(1, sizeof(active_row));
-    payload->s = sizeof(active_row);
-    memset(payload->p, 0, sizeof(active_row));
-    active_row *row = payload->p;
-
-    /* argument required */
-    if (!arg || strlen(arg) < 2)
-    {
-	strcpy(row->state, "NOT_FOUND");
-	row->is = IS_FAILED;
-	return;
-    }
+	payload->p = (active_row *) i_calloc(1, sizeof(active_row));
+	payload->s = sizeof(active_row);
+	memset(payload->p, 0, sizeof(active_row));
+	active_row *row = payload->p;
 
-    /* Find the service in the db */
-    serv = initng_active_db_find_by_name(arg);
-    if (serv)
-    {
-	memcpy(&row->time_set, &serv->time_current_state,
-	       sizeof(struct timeval));
-	strncpy(row->name, serv->name, 100);
-	if (IS_UP(serv))
+	/* argument required */
+	if (!arg || strlen(arg) < 2)
 	{
-	    /* set status == ALREADY_RUNNING */
-	    strcpy(row->state, "ALREADY_RUNNING");
+		strcpy(row->state, "NOT_FOUND");
+		row->is = IS_FAILED;
+		return;
 	}
-	else
+
+	/* Find the service in the db */
+	serv = initng_active_db_find_by_name(arg);
+	if (serv)
 	{
-	    /* Try start this service */
-	    initng_handler_start_service(serv);
-	    /* set current status instead */
-	    strncpy(row->state, serv->current_state->state_name, 100);
-	}
+		memcpy(&row->time_set, &serv->time_current_state,
+			   sizeof(struct timeval));
+		strncpy(row->name, serv->name, 100);
+		if (IS_UP(serv))
+		{
+			/* set status == ALREADY_RUNNING */
+			strcpy(row->state, "ALREADY_RUNNING");
+		}
+		else
+		{
+			/* Try start this service */
+			initng_handler_start_service(serv);
+			/* set current status instead */
+			strncpy(row->state, serv->current_state->state_name, 100);
+		}
 
-	/* the routh state */
-	row->is = serv->current_state->is;
-
-	/* Copy service type name */
-	if (serv->type && serv->type->name)
-	    strncpy(row->type, serv->type->name, 100);
-	return;
-    }
+		/* the routh state */
+		row->is = serv->current_state->is;
 
-    serv = initng_handler_start_new_service_named(arg);
-    if (!serv)
-    {
-	strncpy(row->name, arg, 100);
-	strcpy(row->state, "NOT_FOUND");
-	row->is = IS_FAILED;
-	return;
-    }
+		/* Copy service type name */
+		if (serv->type && serv->type->name)
+			strncpy(row->type, serv->type->name, 100);
+		return;
+	}
 
-    memcpy(&row->time_set, &serv->time_current_state, sizeof(struct timeval));
-    strncpy(row->name, serv->name, 100);
+	serv = initng_handler_start_new_service_named(arg);
+	if (!serv)
+	{
+		strncpy(row->name, arg, 100);
+		strcpy(row->state, "NOT_FOUND");
+		row->is = IS_FAILED;
+		return;
+	}
+
+	memcpy(&row->time_set, &serv->time_current_state, sizeof(struct timeval));
+	strncpy(row->name, serv->name, 100);
 
-    if (serv->current_state && serv->current_state->state_name)
-    {
-	row->is = serv->current_state->is;
-	strncpy(row->state, serv->current_state->state_name, 100);
-	/* Copy service type name */
-	if (serv->type && serv->type->name)
-	    strncpy(row->type, serv->type->name, 100);
-    }
+	if (serv->current_state && serv->current_state->state_name)
+	{
+		row->is = serv->current_state->is;
+		strncpy(row->state, serv->current_state->state_name, 100);
+		/* Copy service type name */
+		if (serv->type && serv->type->name)
+			strncpy(row->type, serv->type->name, 100);
+	}
 }
 
 static void cmd_stop(char *arg, s_payload * payload)
 {
-    active_db_h *serv = NULL;
+	active_db_h *serv = NULL;
 
-    payload->p = (active_row *) i_calloc(1, sizeof(active_row));
-    payload->s = sizeof(active_row);
-    memset(payload->p, 0, sizeof(active_row));
-    active_row *row = payload->p;
-
-    /* argument required */
-    if (!arg || strlen(arg) < 2)
-    {
-	strcpy(row->name, "UNSET");
-	strcpy(row->state, "NOT_FOUND");
-	row->is = IS_FAILED;
-	return;
-    }
+	payload->p = (active_row *) i_calloc(1, sizeof(active_row));
+	payload->s = sizeof(active_row);
+	memset(payload->p, 0, sizeof(active_row));
+	active_row *row = payload->p;
 
-    serv = initng_active_db_find_in_name(arg);
-    if (!serv)
-    {
-	strncpy(row->name, arg, 100);
-	strcpy(row->state, "NOT_FOUND");
-	row->is = IS_FAILED;
-	return;
-    }
+	/* argument required */
+	if (!arg || strlen(arg) < 2)
+	{
+		strcpy(row->name, "UNSET");
+		strcpy(row->state, "NOT_FOUND");
+		row->is = IS_FAILED;
+		return;
+	}
 
-    initng_handler_stop_service(serv);
+	serv = initng_active_db_find_in_name(arg);
+	if (!serv)
+	{
+		strncpy(row->name, arg, 100);
+		strcpy(row->state, "NOT_FOUND");
+		row->is = IS_FAILED;
+		return;
+	}
 
-    row->time_set = serv->time_current_state;
-    strncpy(row->name, serv->name, 100);
+	initng_handler_stop_service(serv);
 
-    if (serv->current_state && serv->current_state->state_name)
-    {
-	row->is = serv->current_state->is;
-
-	/* Copy service type name */
-	if (serv->type && serv->type->name)
-	    strncpy(row->type, serv->type->name, 100);
-
-	/* Copy state name */
-	strncpy(row->state, serv->current_state->state_name, 100);
-    }
-    else
-    {
-	row->is = 0;
-	row->state[0] = '\0';
-    }
+	row->time_set = serv->time_current_state;
+	strncpy(row->name, serv->name, 100);
+
+	if (serv->current_state && serv->current_state->state_name)
+	{
+		row->is = serv->current_state->is;
+
+		/* Copy service type name */
+		if (serv->type && serv->type->name)
+			strncpy(row->type, serv->type->name, 100);
+
+		/* Copy state name */
+		strncpy(row->state, serv->current_state->state_name, 100);
+	}
+	else
+	{
+		row->is = 0;
+		row->state[0] = '\0';
+	}
 }
 
 
 static void cmd_options(char *arg, s_payload * payload)
 {
-    int i = 0;
-    s_entry *current = NULL;
+	int i = 0;
+	s_entry *current = NULL;
 
-    /* if an argument is provided */
-    if (arg && strlen(arg) > 1)
-    {
-	/* malloc some space for it */
-	payload->p = (option_row *) i_calloc(1, sizeof(option_row));
-	memset(payload->p, 0, sizeof(option_row));
-	option_row *row = payload->p;
-
-	strncpy(row->n, arg, 100);
-	strcpy(row->d, "NOT_FOUND");
-	row->t = 0;
-	strcpy(row->o, "UNKNOWN");
-	current = initng_service_data_types_find(arg);
-
-	if (current)
+	/* if an argument is provided */
+	if (arg && strlen(arg) > 1)
 	{
-	    if (current->opt_name)
-		strncpy(row->n, current->opt_name, 100);
-	    if (current->opt_desc)
-		strncpy(row->d, current->opt_desc, 300);
+		/* malloc some space for it */
+		payload->p = (option_row *) i_calloc(1, sizeof(option_row));
+		memset(payload->p, 0, sizeof(option_row));
+		option_row *row = payload->p;
+
+		strncpy(row->n, arg, 100);
+		strcpy(row->d, "NOT_FOUND");
+		row->t = 0;
+		strcpy(row->o, "UNKNOWN");
+		current = initng_service_data_types_find(arg);
 
-	    row->t = current->opt_type;
-	    strncpy(row->o, current->ot->name, 100);
-	}
+		if (current)
+		{
+			if (current->opt_name)
+				strncpy(row->n, current->opt_name, 100);
+			if (current->opt_desc)
+				strncpy(row->d, current->opt_desc, 300);
 
-	payload->s = sizeof(option_row);
-	return;
-    }
+			row->t = current->opt_type;
+			strncpy(row->o, current->ot->name, 100);
+		}
+
+		payload->s = sizeof(option_row);
+		return;
+	}
 
 
-    /* malloc some space for it (static for now) */
-    payload->p = (option_row *) i_calloc(101, sizeof(option_row));
-    memset(payload->p, 0, sizeof(option_row) * 100);
+	/* malloc some space for it (static for now) */
+	payload->p = (option_row *) i_calloc(101, sizeof(option_row));
+	memset(payload->p, 0, sizeof(option_row) * 100);
 
-    while_service_data_types(current)
-    {
-	option_row *row = payload->p + (i * sizeof(option_row));
+	while_service_data_types(current)
+	{
+		option_row *row = payload->p + (i * sizeof(option_row));
 
-	if (!current->opt_name)
-	    continue;
+		if (!current->opt_name)
+			continue;
 
-	row->d[0] = '\0';
+		row->d[0] = '\0';
 
-	strncpy(row->n, current->opt_name, 100);
-	if (current->opt_desc)
-	    strncpy(row->d, current->opt_desc, 300);
+		strncpy(row->n, current->opt_name, 100);
+		if (current->opt_desc)
+			strncpy(row->d, current->opt_desc, 300);
 
-	row->t = current->opt_type;
-	if (current->ot)
-	    strncpy(row->o, current->ot->name, 100);
-	else
-	    strcpy(row->o, "all");
+		row->t = current->opt_type;
+		if (current->ot)
+			strncpy(row->o, current->ot->name, 100);
+		else
+			strcpy(row->o, "all");
 
-	i++;
-    }
+		i++;
+	}
 
-    /* Last, put s, to indicat that there is data */
-    payload->s = i * sizeof(option_row);
+	/* Last, put s, to indicat that there is data */
+	payload->s = i * sizeof(option_row);
 }
 
 
 static void cmd_services(char *arg, s_payload * payload)
 {
-    int i = 0;
-    active_db_h *current = NULL;
+	int i = 0;
+	active_db_h *current = NULL;
 
 
-    /* if an argument is provided */
-    if (arg && strlen(arg) > 1)
-    {
-	/* malloc some space for it */
-	payload->p = (active_row *) i_calloc(1, sizeof(active_row));
-	memset(payload->p, 0, sizeof(active_row));
-	active_row *row = payload->p;
-
-	/* fill with defaults, if no data is found */
-	strncpy(row->name, arg, 100);
-	strcpy(row->state, "NOT_FOUND");
-	row->is = IS_FAILED;
-	if ((current = initng_active_db_find_in_name(arg)))
-	{
-	    if (current->current_state && current->current_state->state_name)
-	    {
-		row->is = current->current_state->is;
-		strncpy(row->state, current->current_state->state_name, 100);
-
-		/* Copy service type name */
-		if (current->type && current->type->name)
-		    strncpy(row->type, current->type->name, 100);
-
-	    }
-	    else
-	    {
-		row->is = 0;
-		row->state[0] = '\0';
-	    }
-	    row->time_set = current->time_current_state;
-	    strncpy(row->name, current->name, 100);
+	/* if an argument is provided */
+	if (arg && strlen(arg) > 1)
+	{
+		/* malloc some space for it */
+		payload->p = (active_row *) i_calloc(1, sizeof(active_row));
+		memset(payload->p, 0, sizeof(active_row));
+		active_row *row = payload->p;
+
+		/* fill with defaults, if no data is found */
+		strncpy(row->name, arg, 100);
+		strcpy(row->state, "NOT_FOUND");
+		row->is = IS_FAILED;
+		if ((current = initng_active_db_find_in_name(arg)))
+		{
+			if (current->current_state && current->current_state->state_name)
+			{
+				row->is = current->current_state->is;
+				strncpy(row->state, current->current_state->state_name, 100);
+
+				/* Copy service type name */
+				if (current->type && current->type->name)
+					strncpy(row->type, current->type->name, 100);
+
+			}
+			else
+			{
+				row->is = 0;
+				row->state[0] = '\0';
+			}
+			row->time_set = current->time_current_state;
+			strncpy(row->name, current->name, 100);
+		}
+		payload->s = sizeof(active_row);
+		return;
 	}
-	payload->s = sizeof(active_row);
-	return;
-    }
 
-    /* else */
+	/* else */
 
-    /* malloc some space for it (static for now) */
-    payload->p = (active_row *) i_calloc(101, sizeof(active_row));
-    memset(payload->p, 0, sizeof(active_row) * 100);
-    current = NULL;
-    while_active_db(current)
-    {
-	active_row *row = payload->p + (i * sizeof(active_row));
-
-	if (current->current_state && current->current_state->state_name)
-	{
-	    row->is = current->current_state->is;
-	    strncpy(row->state, current->current_state->state_name, 100);
-	    /* Copy service type name */
-	    if (current->type && current->type->name)
-		strncpy(row->type, current->type->name, 100);
-	}
-	else
+	/* malloc some space for it (static for now) */
+	payload->p = (active_row *) i_calloc(101, sizeof(active_row));
+	memset(payload->p, 0, sizeof(active_row) * 100);
+	current = NULL;
+	while_active_db(current)
 	{
-	    row->is = 0;
-	    row->state[0] = '\0';
+		active_row *row = payload->p + (i * sizeof(active_row));
+
+		if (current->current_state && current->current_state->state_name)
+		{
+			row->is = current->current_state->is;
+			strncpy(row->state, current->current_state->state_name, 100);
+			/* Copy service type name */
+			if (current->type && current->type->name)
+				strncpy(row->type, current->type->name, 100);
+		}
+		else
+		{
+			row->is = 0;
+			row->state[0] = '\0';
+		}
+		row->time_set = current->time_current_state;
+		strncpy(row->name, current->name, 100);
+		i++;
 	}
-	row->time_set = current->time_current_state;
-	strncpy(row->name, current->name, 100);
-	i++;
-    }
 
-    payload->s = i * sizeof(active_row);
+	payload->s = i * sizeof(active_row);
 }
 
 
@@ -1154,27 +1154,27 @@
  */
 
 s_command HELP = { 'h', "help", DATA_COMMANDS_ROW, STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_help}, "Print what commands you can send to initng."
+	{(void *) &cmd_help}, "Print what commands you can send to initng."
 };
 
 s_command HELP_ALL = { 'H', "help_all", DATA_COMMANDS_ROW, STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_help_all}, "Print out verbose list of all commands."
+	{(void *) &cmd_help_all}, "Print out verbose list of all commands."
 };
 
 s_command SERVICES = { 's', "status", DATA_ACTIVE_ROW, STANDARD_COMMAND, USES_OPT,
-    {(void *) &cmd_services}, "Print out service_db."
+	{(void *) &cmd_services}, "Print out service_db."
 };
 
 s_command OPTIONS = { 'O', "options", DATA_OPTION_ROW, ADVANCHED_COMMAND, USES_OPT,
-    {(void *) &cmd_options}, "Print out option_db."
+	{(void *) &cmd_options}, "Print out option_db."
 };
 
 s_command START = { 'u', "start", DATA_ACTIVE_ROW, STANDARD_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_start}, "Start service."
+	{(void *) &cmd_start}, "Start service."
 };
 
 s_command STOP = { 'd', "stop", DATA_ACTIVE_ROW, STANDARD_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_stop}, "Stop service."
+	{(void *) &cmd_stop}, "Stop service."
 };
 
 
@@ -1184,61 +1184,61 @@
 
 int module_init(int api_version)
 {
-    D_("module_init(ngc2);\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    /* initziate the local commands db */
-    INIT_LIST_HEAD(&local_commands_db.list);
-
-    /* zero globals */
-    fdh.fds = -1;
-    memset(&sock_stat, 0, sizeof(sock_stat));
-
-
-    /* decide which socket to use */
-    if (g.i_am_init)
-	socket_filename = SOCKET_4_FILENAME_REAL;
-    else
-	socket_filename = SOCKET_4_FILENAME_TEST;
-
-    D_("Socket is: %s\n", socket_filename);
-
-    D_("adding hook, that will reopen socket, for every started service.\n");
-    initng_plugin_hook_add(&g.FDWATCHERS, 30, &fdh);
-    initng_plugin_hook_add(&g.SIGNAL, 50, &check_socket);
-
-    /* add the help command, that list commands to the client */
-    list_add(&HELP.list, &local_commands_db.list);
-    list_add(&HELP_ALL.list, &local_commands_db.list);
-    list_add(&SERVICES.list, &local_commands_db.list);
-    list_add(&OPTIONS.list, &local_commands_db.list);
-    list_add(&START.list, &local_commands_db.list);
-    list_add(&STOP.list, &local_commands_db.list);
+	D_("module_init(ngc2);\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	/* initziate the local commands db */
+	INIT_LIST_HEAD(&local_commands_db.list);
+
+	/* zero globals */
+	fdh.fds = -1;
+	memset(&sock_stat, 0, sizeof(sock_stat));
+
+
+	/* decide which socket to use */
+	if (g.i_am_init)
+		socket_filename = SOCKET_4_FILENAME_REAL;
+	else
+		socket_filename = SOCKET_4_FILENAME_TEST;
 
-    /* do the first socket directly */
-    open_socket();
+	D_("Socket is: %s\n", socket_filename);
 
-    D_("ngc2.so.0.0 loaded!\n");
-    return (TRUE);
+	D_("adding hook, that will reopen socket, for every started service.\n");
+	initng_plugin_hook_add(&g.FDWATCHERS, 30, &fdh);
+	initng_plugin_hook_add(&g.SIGNAL, 50, &check_socket);
+
+	/* add the help command, that list commands to the client */
+	list_add(&HELP.list, &local_commands_db.list);
+	list_add(&HELP_ALL.list, &local_commands_db.list);
+	list_add(&SERVICES.list, &local_commands_db.list);
+	list_add(&OPTIONS.list, &local_commands_db.list);
+	list_add(&START.list, &local_commands_db.list);
+	list_add(&STOP.list, &local_commands_db.list);
+
+	/* do the first socket directly */
+	open_socket();
+
+	D_("ngc2.so.0.0 loaded!\n");
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    D_("module_unload(ngc2);\n");
+	D_("module_unload(ngc2);\n");
 
-    /* close open sockets */
-    closesock();
+	/* close open sockets */
+	closesock();
 
 
-    /* remove hooks */
-    initng_plugin_hook_del(&g.FDWATCHERS, &fdh);
-    initng_plugin_hook_del(&g.SIGNAL, &check_socket);
+	/* remove hooks */
+	initng_plugin_hook_del(&g.FDWATCHERS, &fdh);
+	initng_plugin_hook_del(&g.SIGNAL, &check_socket);
 
-    D_("ngc2.so.0.0 unloaded!\n");
+	D_("ngc2.so.0.0 unloaded!\n");
 
 }

Modified: initng/trunk/plugins/ngc4/initng_ngc4.h
==============================================================================
--- initng/trunk/plugins/ngc4/initng_ngc4.h	(original)
+++ initng/trunk/plugins/ngc4/initng_ngc4.h	Wed Apr  5 23:11:19 2006
@@ -34,41 +34,41 @@
 /* this is a structure for an help_row payload */
 typedef struct
 {
-    char c;
-    char l[101];
-    e_com_type t;
-    e_opt_type o;
-    char d[201];
+	char c;
+	char l[101];
+	e_com_type t;
+	e_opt_type o;
+	char d[201];
 } help_row;
 
 /* this is a structure for an active_row payload */
 typedef struct
 {
-    char state[101];		/* status, a word describing the status */
-    char name[101];		/* name of service */
-    struct timeval time_set;	/* time status set */
-    e_is is;			/* is status, status in a number */
-    char type[101];		/* Type of service this is */
+	char state[101];			/* status, a word describing the status */
+	char name[101];				/* name of service */
+	struct timeval time_set;	/* time status set */
+	e_is is;					/* is status, status in a number */
+	char type[101];				/* Type of service this is */
 } active_row;
 
 /* this is a structure for an option_row payload */
 typedef struct
 {
-    char n[101];
-    e_dt t;
-    char o[101];
-    char d[301];
+	char n[101];
+	e_dt t;
+	char o[101];
+	char d[301];
 } option_row;
 
 /* an enum sent in the reply, signals the status of the reply */
 typedef enum
 {
-    S_FALSE = 0,
-    S_TRUE = 1,
-    S_REQUIRES_OPT = 2,
-    S_NOT_REQUIRES_OPT = 3,
-    S_INVALID_TYPE = 4,
-    S_COMMAND_NOT_FOUND = 5
+	S_FALSE = 0,
+	S_TRUE = 1,
+	S_REQUIRES_OPT = 2,
+	S_NOT_REQUIRES_OPT = 3,
+	S_INVALID_TYPE = 4,
+	S_COMMAND_NOT_FOUND = 5
 } e_suceed;
 
 /*
@@ -77,12 +77,12 @@
  */
 typedef struct
 {
-    e_suceed s;			/* succeed, TRUE or FALSE */
-    char c;
-    e_com_type t;		/* type of data got back */
-    char version[101];
-    int p_ver;
-    size_t payload;
+	e_suceed s;					/* succeed, TRUE or FALSE */
+	char c;
+	e_com_type t;				/* type of data got back */
+	char version[101];
+	int p_ver;
+	size_t payload;
 } result_desc;
 
 /*
@@ -91,10 +91,10 @@
  */
 typedef struct
 {
-    char c;
-    char l[101];
-    int p_ver;
-    size_t body_len;
+	char c;
+	char l[101];
+	int p_ver;
+	size_t body_len;
 } read_header;
 
 #endif

Modified: initng/trunk/plugins/ngc4/libngcclient.c
==============================================================================
--- initng/trunk/plugins/ngc4/libngcclient.c	(original)
+++ initng/trunk/plugins/ngc4/libngcclient.c	Wed Apr  5 23:11:19 2006
@@ -62,57 +62,57 @@
 /* open socket to communicate with */
 static int ngcclient_open_socket(const char *path)
 {
-    int len;
-    struct sockaddr_un sockname;
+	int len;
+	struct sockaddr_un sockname;
 
-    assert(path);
+	assert(path);
 
-    int sock = -1;
+	int sock = -1;
 
-    /* Create the socket. */
-    sock = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (sock < 0)
-    {
-	ngcclient_error = "Failed to init socket";
-	return (FALSE);
-    }
-
-    /* Bind a name to the socket. */
-    sockname.sun_family = AF_UNIX;
-    strcpy(sockname.sun_path, path);
-
-    /* calculate length of sockname */
-    len = strlen(sockname.sun_path) + sizeof(sockname.sun_family);
-
-    if (connect(sock, (struct sockaddr *) &sockname, len) < 0)
-    {
-	close(sock);
-	ngcclient_error = "Error connecting to initng socket";
-	return (FALSE);
-    }
-
-
-    /* Put it not to block, waiting for more data on rscv */
-    /*{
-       int cur = fcntl(sock, F_GETFL, 0);
-       fcntl(sock, F_SETFL, cur | O_NONBLOCK);
-       } */
-
-
-    /* return happily */
-    ngcclient_error = NULL;
-    return (sock);
+	/* Create the socket. */
+	sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (sock < 0)
+	{
+		ngcclient_error = "Failed to init socket";
+		return (FALSE);
+	}
+
+	/* Bind a name to the socket. */
+	sockname.sun_family = AF_UNIX;
+	strcpy(sockname.sun_path, path);
+
+	/* calculate length of sockname */
+	len = strlen(sockname.sun_path) + sizeof(sockname.sun_family);
+
+	if (connect(sock, (struct sockaddr *) &sockname, len) < 0)
+	{
+		close(sock);
+		ngcclient_error = "Error connecting to initng socket";
+		return (FALSE);
+	}
+
+
+	/* Put it not to block, waiting for more data on rscv */
+	/*{
+	   int cur = fcntl(sock, F_GETFL, 0);
+	   fcntl(sock, F_SETFL, cur | O_NONBLOCK);
+	   } */
+
+
+	/* return happily */
+	ngcclient_error = NULL;
+	return (sock);
 }
 
 
 /* close pipes */
 static void ngcclient_close_socket(int sock)
 {
-    if (sock != -1)
-    {
-	close(sock);
-	sock = -1;
-    }
+	if (sock != -1)
+	{
+		close(sock);
+		sock = -1;
+	}
 }
 
 #define ngcclient_send_short_command(c, o) ngcclient_send_command(c, NULL, o)
@@ -120,179 +120,179 @@
 
 /* send a command */
 reply *ngcclient_send_command(const char *path, const char c, const char *l,
-			      const char *o)
+							  const char *o)
 {
-    read_header header;
-    reply *rep;
-    int sock = -1;
-
-    /* clear structure just in case */
-    memset(&header, 0, sizeof(read_header));
-    header.p_ver = PROTOCOL_4_VERSION;
-
-    /* allocate the rep */
-    rep = calloc(1, sizeof(reply));
-
-    /* fill the header with data */
-    header.c = c;
-    if (l)
-	strncpy(header.l, l, 100);
-    else
-	header.l[0] = '\0';
-
-    /* if there is an option string, we have to know length */
-    if (o)
-	header.body_len = strlen(o) * sizeof(char);
-
-    /*print_out("Sending: %c, %s, %s\n", c, l ,o); */
-
-    /* open the socket two way to initng */
-    if ((sock = ngcclient_open_socket(path)) < 1)
-    {
+	read_header header;
+	reply *rep;
+	int sock = -1;
+
+	/* clear structure just in case */
+	memset(&header, 0, sizeof(read_header));
+	header.p_ver = PROTOCOL_4_VERSION;
+
+	/* allocate the rep */
+	rep = calloc(1, sizeof(reply));
+
+	/* fill the header with data */
+	header.c = c;
+	if (l)
+		strncpy(header.l, l, 100);
+	else
+		header.l[0] = '\0';
+
+	/* if there is an option string, we have to know length */
+	if (o)
+		header.body_len = strlen(o) * sizeof(char);
+
+	/*print_out("Sending: %c, %s, %s\n", c, l ,o); */
+
+	/* open the socket two way to initng */
+	if ((sock = ngcclient_open_socket(path)) < 1)
+	{
+		/*
+		 * Set in ngcclient_open_socket()
+		 * ngcclient_error="Socket is not open, or failed to open!";
+		 */
+		return (NULL);
+	}
+
+	/* send the header */
+	if (send(sock, &header, sizeof(read_header), 0) <
+		(signed) sizeof(read_header))
+	{
+		ngcclient_error = "Could not send header!";
+		return (NULL);
+	}
+
+	/* Also send the content of body (usually a string) */
+	if (send(sock, o, header.body_len, 0) < (signed) header.body_len)
+	{
+		ngcclient_error = "Could not send body!";
+		return (NULL);
+	}
+
+	/* no idea to stress initng */
+	usleep(50000);
+
 	/*
-	 * Set in ngcclient_open_socket()
-	 * ngcclient_error="Socket is not open, or failed to open!";
+	 * SPECIAL CASE, when using ngc -c, (RELOAD INITNG)
+	 * initng starts reloading directly we wont ever get an reply
+	 * so youst return happily here
 	 */
-	return (NULL);
-    }
+	if (header.c == 'c')
+	{
+		ngcclient_error = NULL;
+		ngcclient_close_socket(sock);
 
-    /* send the header */
-    if (send(sock, &header, sizeof(read_header), 0) <
-	(signed) sizeof(read_header))
-    {
-	ngcclient_error = "Could not send header!";
-	return (NULL);
-    }
-
-    /* Also send the content of body (usually a string) */
-    if (send(sock, o, header.body_len, 0) < (signed) header.body_len)
-    {
-	ngcclient_error = "Could not send body!";
-	return (NULL);
-    }
-
-    /* no idea to stress initng */
-    usleep(50000);
-
-    /*
-     * SPECIAL CASE, when using ngc -c, (RELOAD INITNG)
-     * initng starts reloading directly we wont ever get an reply
-     * so youst return happily here
-     */
-    if (header.c == 'c')
-    {
-	ngcclient_error = NULL;
-	ngcclient_close_socket(sock);
+		/* fabricate an reply, and return that */
+		rep->result.s = TRUE;
+		rep->result.c = 'c';
+		rep->result.t = STRING_COMMAND;
+		strcpy(rep->result.version, "Fake reply, not from initng\n");
+		rep->result.p_ver = PROTOCOL_4_VERSION;
+		rep->payload = (char *) strdup("On ngc -c, initng reloads itself. By that it closes the connection to ngc and so can not return if this command succeds or not.");
+		rep->result.payload = strlen(rep->payload) * sizeof(char);
 
-	/* fabricate an reply, and return that */
-	rep->result.s = TRUE;
-	rep->result.c = 'c';
-	rep->result.t = STRING_COMMAND;
-	strcpy(rep->result.version, "Fake reply, not from initng\n");
-	rep->result.p_ver = PROTOCOL_4_VERSION;
-	rep->payload = (char *) strdup("On ngc -c, initng reloads itself. By that it closes the connection to ngc and so can not return if this command succeds or not.");
-	rep->result.payload = strlen(rep->payload) * sizeof(char);
+		return (rep);
+	}
+
+	/* FETCH THE RESULT */
+
+	int res = 0;
+
+	/* read header data */
+	res = TEMP_FAILURE_RETRY(recv
+							 (sock, &rep->result, sizeof(result_desc), 0));
+	if (res < (signed) sizeof(result_desc))
+	{
+		ngcclient_error = "failed to fetch the result.";
+		return (NULL);
+	}
 
-	return (rep);
-    }
 
-    /* FETCH THE RESULT */
+	/*printf("Res: %i should be %i # errno:%i\n", res, sizeof(result_desc), errno);
+	   printf("result: s: %i, c: '%c', t: %i, version: \"%.10s...\", p_ver: %i, payload: %i\n",
+	   rep->result.s, rep->result.c, rep->result.t, rep->result.version,
+	   rep->result.p_ver, rep->result.payload); */
 
-    int res = 0;
 
-    /* read header data */
-    res = TEMP_FAILURE_RETRY(recv
-			     (sock, &rep->result, sizeof(result_desc), 0));
-    if (res < (signed) sizeof(result_desc))
-    {
-	ngcclient_error = "failed to fetch the result.";
-	return (NULL);
-    }
-
-
-    /*printf("Res: %i should be %i # errno:%i\n", res, sizeof(result_desc), errno);
-       printf("result: s: %i, c: '%c', t: %i, version: \"%.10s...\", p_ver: %i, payload: %i\n",
-       rep->result.s, rep->result.c, rep->result.t, rep->result.version,
-       rep->result.p_ver, rep->result.payload); */
-
-
-    /* check that protocol matches */
-    if (rep->result.p_ver != PROTOCOL_4_VERSION)
-    {
-	printf("protocol missmatch %i:%i\n", rep->result.p_ver,
-	       PROTOCOL_4_VERSION);
-	ngcclient_error = "PROTOCOL_4_VERSION missmatch!";
-	free(rep);
-	return (NULL);
-    }
-
-    /* ok, parse how inting thinks this request succeds */
-    switch (rep->result.s)
-    {
-	case S_FALSE:
-	    ngcclient_error = "Request returns negative.";
-	    free(rep);
-	    return (NULL);
-
-	case S_REQUIRES_OPT:
-	    ngcclient_error = "The command requires an option!";
-	    free(rep);
-	    return (NULL);
-
-	case S_NOT_REQUIRES_OPT:
-	    ngcclient_error = "The command cant have an option!";
-	    free(rep);
-	    return (NULL);
-
-	case S_INVALID_TYPE:
-	    ngcclient_error = "The data returning of this command is an unknown type.";
-	    free(rep);
-	    return (NULL);
-
-	case S_COMMAND_NOT_FOUND:
-	    ngcclient_error = "Command not found.";
-	    free(rep);
-	    return (NULL);
-
-	    /* This is a good one */
-	case S_TRUE:
-	    break;
-
-	default:
-	    ngcclient_error = "Unknown error.";
-	    free(rep);
-	    return (NULL);
-    }
-
-    /* if there was a payload, download that too */
-    if (rep->result.payload > 0)
-    {
-	ssize_t got = 0;
-
-	/*printf("There is a payload.\n"); */
-
-	/* i allocate 1 byte extra, to be sure a null on the end */
-	rep->payload = calloc(1, rep->result.payload + 1);
-	if (!rep->payload)
+	/* check that protocol matches */
+	if (rep->result.p_ver != PROTOCOL_4_VERSION)
 	{
-	    ngcclient_error = "Unable to allocate space for payload.";
-	    return (NULL);
+		printf("protocol missmatch %i:%i\n", rep->result.p_ver,
+			   PROTOCOL_4_VERSION);
+		ngcclient_error = "PROTOCOL_4_VERSION missmatch!";
+		free(rep);
+		return (NULL);
 	}
 
-	/* sleep a bit, to make sure initng filled the buffer */
-	usleep(50000);
+	/* ok, parse how inting thinks this request succeds */
+	switch (rep->result.s)
+	{
+		case S_FALSE:
+			ngcclient_error = "Request returns negative.";
+			free(rep);
+			return (NULL);
 
-	got = TEMP_FAILURE_RETRY(recv
-				 (sock, rep->payload, rep->result.payload,
-				  0));
-	/* printf("got an payload of: %i bytes, suposed to be %i. #errno %i\n", got, rep->result.payload, errno); */
-    }
+		case S_REQUIRES_OPT:
+			ngcclient_error = "The command requires an option!";
+			free(rep);
+			return (NULL);
 
+		case S_NOT_REQUIRES_OPT:
+			ngcclient_error = "The command cant have an option!";
+			free(rep);
+			return (NULL);
 
-    /* close the socket */
-    ngcclient_close_socket(sock);
+		case S_INVALID_TYPE:
+			ngcclient_error = "The data returning of this command is an unknown type.";
+			free(rep);
+			return (NULL);
 
-    return (rep);
+		case S_COMMAND_NOT_FOUND:
+			ngcclient_error = "Command not found.";
+			free(rep);
+			return (NULL);
+
+			/* This is a good one */
+		case S_TRUE:
+			break;
+
+		default:
+			ngcclient_error = "Unknown error.";
+			free(rep);
+			return (NULL);
+	}
+
+	/* if there was a payload, download that too */
+	if (rep->result.payload > 0)
+	{
+		ssize_t got = 0;
+
+		/*printf("There is a payload.\n"); */
+
+		/* i allocate 1 byte extra, to be sure a null on the end */
+		rep->payload = calloc(1, rep->result.payload + 1);
+		if (!rep->payload)
+		{
+			ngcclient_error = "Unable to allocate space for payload.";
+			return (NULL);
+		}
+
+		/* sleep a bit, to make sure initng filled the buffer */
+		usleep(50000);
+
+		got = TEMP_FAILURE_RETRY(recv
+								 (sock, rep->payload, rep->result.payload,
+								  0));
+		/* printf("got an payload of: %i bytes, suposed to be %i. #errno %i\n", got, rep->result.payload, errno); */
+	}
+
+
+	/* close the socket */
+	ngcclient_close_socket(sock);
+
+	return (rep);
 }
 
 /*
@@ -301,172 +301,172 @@
  */
 static int mprintf(char **p, const char *format, ...)
 {
-    va_list arg;		/* used for the variable lists */
+	va_list arg;				/* used for the variable lists */
 
-    int len = 0;		/* will contain lent for current string */
-    int add_len = 0;		/* This mutch more strings are we gonna alloc for */
+	int len = 0;				/* will contain lent for current string */
+	int add_len = 0;			/* This mutch more strings are we gonna alloc for */
 
-    assert(p);
+	assert(p);
 
-    /*printf("\n\nmprintf(%s);\n", format); */
+	/*printf("\n\nmprintf(%s);\n", format); */
 
-    /* count old chars */
-    if (*p)
-	len = strlen(*p);
-
-    /*
-     * format contains the minimum needed chars that
-     * are gonna be used, so we set that value and try
-     * with that.
-     */
-    add_len = strlen(format) + 1;
-
-    /*
-     * Now realloc the memoryspace containing the
-     * string so that the new apending string will
-     * have room.
-     * Also have a check that it succeds.
-     */
-    /*printf("Changing size to %i\n", len + add_len); */
-    if (!(*p = realloc(*p, ((len + add_len) * sizeof(char)))))
-	return (-1);
+	/* count old chars */
+	if (*p)
+		len = strlen(*p);
 
-    /* Ok, have a try until vsnprintf succeds */
-    while (1)
-    {
-	/* start filling the newly allocaded area */
-	va_start(arg, format);
-	int done = vsnprintf((*p) + len, add_len, format, arg);
+	/*
+	 * format contains the minimum needed chars that
+	 * are gonna be used, so we set that value and try
+	 * with that.
+	 */
+	add_len = strlen(format) + 1;
 
-	va_end(arg);
+	/*
+	 * Now realloc the memoryspace containing the
+	 * string so that the new apending string will
+	 * have room.
+	 * Also have a check that it succeds.
+	 */
+	/*printf("Changing size to %i\n", len + add_len); */
+	if (!(*p = realloc(*p, ((len + add_len) * sizeof(char)))))
+		return (-1);
 
-	/* check if that was enouth */
-	if (done > -1 && done < add_len)
+	/* Ok, have a try until vsnprintf succeds */
+	while (1)
 	{
-	    /*printf("GOOD: done : %i, len: %i\n", done, add_len); */
+		/* start filling the newly allocaded area */
+		va_start(arg, format);
+		int done = vsnprintf((*p) + len, add_len, format, arg);
 
-	    /* Ok return happily */
-	    return (done);
-	}
-	/*printf("BAD: done : %i, len: %i\n", done, add_len); */
+		va_end(arg);
 
-	/* try increase it a bit. */
-	add_len = (done < 0 ? add_len * 2 : done + 1);
-	/*printf("Changing size to %i\n", len + add_len); */
-	if (!(*p = realloc(*p, ((len + add_len) * sizeof(char)))))
-	    return (-1);
+		/* check if that was enouth */
+		if (done > -1 && done < add_len)
+		{
+			/*printf("GOOD: done : %i, len: %i\n", done, add_len); */
+
+			/* Ok return happily */
+			return (done);
+		}
+		/*printf("BAD: done : %i, len: %i\n", done, add_len); */
 
-    }
+		/* try increase it a bit. */
+		add_len = (done < 0 ? add_len * 2 : done + 1);
+		/*printf("Changing size to %i\n", len + add_len); */
+		if (!(*p = realloc(*p, ((len + add_len) * sizeof(char)))))
+			return (-1);
 
-    /* will never go here */
-    return (-1);
+	}
+
+	/* will never go here */
+	return (-1);
 }
 
 
 /* little tool for sending command, and get a nice string return */
 char *ngcclient_reply_to_string(reply * rep, int ansi)
 {
-    char *string = NULL;
-
-    /*
-     * Make sure ngcclient_error is not set,
-     * this should be checkked before calling this function
-     */
-    if (ngcclient_error)
-    {
-	string = strdup(ngcclient_error);
-	return (string);
-    }
+	char *string = NULL;
 
-    /* Make sure we got the result */
-    if (!rep)
-    {
-	string = strdup("Unable to get reply.");
-	return (string);
-    }
-
-
-    /* Have a look what the result is */
-    switch (rep->result.t)
-    {
-	    /* if it returned a string, print it */
-	case STRING_COMMAND:
-	    if (!rep->payload || rep->result.payload == 0)
-	    {
-		string = strdup("No payload.\n");
-		return (string);
-	    }
-	    string = (char *) rep->payload;
-	    break;
-	    /* if it returned some data, call data handlers */
-	case PAYLOAD_COMMAND:
-	    string = strdup("Command not supported.");
-	    break;
-	case DATA_COMMANDS_ROW:
-	    if (!rep->payload || rep->result.payload == 0)
-	    {
-		string = strdup("No payload.\n");
-		return (string);
-	    }
-	    string = ngc_hlp(rep, ansi);
-	    break;
-	case DATA_ACTIVE_ROW:
-	    if (!rep->payload || rep->result.payload == 0)
-	    {
-		string = strdup("No payload.\n");
-		return (string);
-	    }
-	    string = ngc_active_db(rep, ansi);
-	    break;
-	case DATA_OPTION_ROW:
-	    if (!rep->payload || rep->result.payload == 0)
-	    {
-		string = strdup("No payload.\n");
-		return (string);
-	    }
-	    string = ngc_option_db(rep, ansi);
-	    break;
-	case INT_COMMAND:
-	    if (!rep->payload || rep->result.payload == 0)
-	    {
-		string = strdup("No payload.\n");
+	/*
+	 * Make sure ngcclient_error is not set,
+	 * this should be checkked before calling this function
+	 */
+	if (ngcclient_error)
+	{
+		string = strdup(ngcclient_error);
 		return (string);
-	    }
-	    {
-		/* simplest create an int pointer */
-		int *p = rep->payload;
-
-		sprintf(string, "%i", *p);
-		break;
-	    }
-	case VOID_COMMAND:
-	    string = strdup("Command succeded without reply.");
-	    break;
-	case COMMAND_FAIL:
-	    string = strdup("Command replied a failure.");
-	    break;
-	case TRUE_OR_FALSE_COMMAND:
-	    if (!rep->payload || rep->result.payload == 0)
-	    {
-		string = strdup("No payload.\n");
+	}
+
+	/* Make sure we got the result */
+	if (!rep)
+	{
+		string = strdup("Unable to get reply.");
 		return (string);
-	    }
-	    {
-		int *p = rep->payload;
+	}
 
-		if (*p > 0)
-		{
-		    string = strdup("Command POSITIVE.");
-		    break;
-		}
 
-		string = strdup("Command NEGATIVE.");
-		break;
-	    }
-    }
+	/* Have a look what the result is */
+	switch (rep->result.t)
+	{
+			/* if it returned a string, print it */
+		case STRING_COMMAND:
+			if (!rep->payload || rep->result.payload == 0)
+			{
+				string = strdup("No payload.\n");
+				return (string);
+			}
+			string = (char *) rep->payload;
+			break;
+			/* if it returned some data, call data handlers */
+		case PAYLOAD_COMMAND:
+			string = strdup("Command not supported.");
+			break;
+		case DATA_COMMANDS_ROW:
+			if (!rep->payload || rep->result.payload == 0)
+			{
+				string = strdup("No payload.\n");
+				return (string);
+			}
+			string = ngc_hlp(rep, ansi);
+			break;
+		case DATA_ACTIVE_ROW:
+			if (!rep->payload || rep->result.payload == 0)
+			{
+				string = strdup("No payload.\n");
+				return (string);
+			}
+			string = ngc_active_db(rep, ansi);
+			break;
+		case DATA_OPTION_ROW:
+			if (!rep->payload || rep->result.payload == 0)
+			{
+				string = strdup("No payload.\n");
+				return (string);
+			}
+			string = ngc_option_db(rep, ansi);
+			break;
+		case INT_COMMAND:
+			if (!rep->payload || rep->result.payload == 0)
+			{
+				string = strdup("No payload.\n");
+				return (string);
+			}
+			{
+				/* simplest create an int pointer */
+				int *p = rep->payload;
+
+				sprintf(string, "%i", *p);
+				break;
+			}
+		case VOID_COMMAND:
+			string = strdup("Command succeded without reply.");
+			break;
+		case COMMAND_FAIL:
+			string = strdup("Command replied a failure.");
+			break;
+		case TRUE_OR_FALSE_COMMAND:
+			if (!rep->payload || rep->result.payload == 0)
+			{
+				string = strdup("No payload.\n");
+				return (string);
+			}
+			{
+				int *p = rep->payload;
+
+				if (*p > 0)
+				{
+					string = strdup("Command POSITIVE.");
+					break;
+				}
+
+				string = strdup("Command NEGATIVE.");
+				break;
+			}
+	}
 
-    /* free */
-    return (string);
+	/* free */
+	return (string);
 }
 
 
@@ -477,254 +477,254 @@
 /* get help */
 char *ngc_hlp(reply * rep, int ansi)
 {
-    char *string = NULL;
+	char *string = NULL;
 
-    assert(rep);
-    /* data got */
-    help_row *row = rep->payload;
-
-    /* print head */
-    mprintf(&string, " ngc understand this commands:\n\n");
-    mprintf(&string,
-	    " short Option                          : description\n");
-    mprintf(&string,
-	    " ----------------------------------------------------------\n");
-
-    while (row->c)
-    {
-	char lname[256];
+	assert(rep);
+	/* data got */
+	help_row *row = rep->payload;
 
-	/* copy name to the new static array */
-	strncpy(lname, row->l, 200);
+	/* print head */
+	mprintf(&string, " ngc understand this commands:\n\n");
+	mprintf(&string,
+			" short Option                          : description\n");
+	mprintf(&string,
+			" ----------------------------------------------------------\n");
 
-	if (ansi)
-	{
-	    switch (row->o)
-	    {
-		case USES_OPT:
-		    strcat(lname, C_FG_YELLOW " <opt>" C_OFF);
-		    break;
-		case REQUIRES_OPT:
-		    strcat(lname, C_FG_CYAN " opt" C_OFF);
-		    break;
-		default:
-		    strcat(lname, C_FG_CYAN C_OFF);
-		    break;
-	    }
-	}
-	else
+	while (row->c)
 	{
-	    switch (row->o)
-	    {
-		case USES_OPT:
-		    strcat(lname, " <opt>");
-		    break;
-		case REQUIRES_OPT:
-		    strcat(lname, " opt");
-		    break;
-		default:
-		    break;
-	    }
-	}
+		char lname[256];
 
-	/* to prevent an possible overflow */
-	lname[255] = '\0';
+		/* copy name to the new static array */
+		strncpy(lname, row->l, 200);
 
-	if (row->c != '\0')
-	{
-	    if (ansi)
-	    {
-		mprintf(&string,
-			" [" C_FG_LIGHT_RED "-%c" C_OFF "] --%-40s: %s\n",
-			row->c, lname, row->d);
-	    }
-	    else
-	    {
-		mprintf(&string, " [-%c] --%-40s: %s\n",
-			row->c, lname, row->d);
-	    }
-	}
-	else
-	{
-	    mprintf(&string, "       --%-40s: %s\n", lname, row->d);
-	}
+		if (ansi)
+		{
+			switch (row->o)
+			{
+				case USES_OPT:
+					strcat(lname, C_FG_YELLOW " <opt>" C_OFF);
+					break;
+				case REQUIRES_OPT:
+					strcat(lname, C_FG_CYAN " opt" C_OFF);
+					break;
+				default:
+					strcat(lname, C_FG_CYAN C_OFF);
+					break;
+			}
+		}
+		else
+		{
+			switch (row->o)
+			{
+				case USES_OPT:
+					strcat(lname, " <opt>");
+					break;
+				case REQUIRES_OPT:
+					strcat(lname, " opt");
+					break;
+				default:
+					break;
+			}
+		}
+
+		/* to prevent an possible overflow */
+		lname[255] = '\0';
+
+		if (row->c != '\0')
+		{
+			if (ansi)
+			{
+				mprintf(&string,
+						" [" C_FG_LIGHT_RED "-%c" C_OFF "] --%-40s: %s\n",
+						row->c, lname, row->d);
+			}
+			else
+			{
+				mprintf(&string, " [-%c] --%-40s: %s\n",
+						row->c, lname, row->d);
+			}
+		}
+		else
+		{
+			mprintf(&string, "       --%-40s: %s\n", lname, row->d);
+		}
 
-	row++;
+		row++;
 
-    }
-    return (string);
+	}
+	return (string);
 }
 
 
 char *ngc_active_db(reply * rep, int ansi)
 {
-    active_row *row = rep->payload;
-    char *string = NULL;
-    struct timeval now;
-
-    assert(rep);
-
-    gettimeofday(&now, NULL);
-
-    /* print head */
-    if (ansi)
-    {
-	mprintf(&string, C_FG_LIGHT_RED "hh:mm:ss" C_OFF
-		C_FG_CYAN " T " C_OFF
-		"service                             : " C_FG_NEON_GREEN
-		"status\n" C_OFF);
-    }
-    else
-    {
-	mprintf(&string,
-		"hh:mm:ss T service                             : status\n");
-    }
+	active_row *row = rep->payload;
+	char *string = NULL;
+	struct timeval now;
 
-    /* don't make it weighter! only 80chars, not weighter. */
-    mprintf(&string,
-	    "----------------------------------------------------------------\n");
-
-    while (row->state[0])
-    {
-	struct tm *ts = localtime(&row->time_set.tv_sec);
+	assert(rep);
 
-	/* don't make it weighter! only 80chars, not weighter. */
+	gettimeofday(&now, NULL);
+
+	/* print head */
 	if (ansi)
 	{
-	    mprintf(&string,
-		    C_FG_LIGHT_RED "%.2i:%.2i:%.2i" C_OFF C_FG_CYAN " %c"
-		    C_OFF " %-35s : ", ts->tm_hour, ts->tm_min, ts->tm_sec,
-		    (char) toupper((int) row->type[0]), row->name);
+		mprintf(&string, C_FG_LIGHT_RED "hh:mm:ss" C_OFF
+				C_FG_CYAN " T " C_OFF
+				"service                             : " C_FG_NEON_GREEN
+				"status\n" C_OFF);
 	}
 	else
 	{
-	    mprintf(&string, "%.2i:%.2i:%.2i %c %-35s : ",
-		    ts->tm_hour, ts->tm_min, ts->tm_sec,
-		    (char) toupper((int) row->type), row->name);
+		mprintf(&string,
+				"hh:mm:ss T service                             : status\n");
 	}
 
-	if (ansi)
-	{
-	    switch (row->is)
-	    {
-		case IS_UP:
-		    mprintf(&string, C_FG_NEON_GREEN "%s" C_OFF "\n",
-			    row->state);
-		    break;
-		case IS_DOWN:
-		    mprintf(&string, C_FG_LIGHT_BLUE "%s" C_OFF "\n",
-			    row->state);
-		    break;
-		case IS_FAILED:
-		    mprintf(&string, C_FG_LIGHT_RED "%s" C_OFF "\n",
-			    row->state);
-		    break;
-		case IS_STARTING:
-		    mprintf(&string, C_FG_YELLOW "%s" C_OFF "\n", row->state);
-		    break;
-		case IS_STOPPING:
-		    mprintf(&string, C_FG_CYAN "%s" C_OFF "\n", row->state);
-		    break;
-		case IS_WAITING:
-		    mprintf(&string, C_FG_MAGENTA "%s" C_OFF "\n",
-			    row->state);
-		    break;
-		case IS_UNKNOWN:
-		    mprintf(&string, "%s\n", row->state);
-		    break;
-	    }
-	}
-	else
+	/* don't make it weighter! only 80chars, not weighter. */
+	mprintf(&string,
+			"----------------------------------------------------------------\n");
+
+	while (row->state[0])
 	{
-	    mprintf(&string, "%s\n", row->state);
-	}
+		struct tm *ts = localtime(&row->time_set.tv_sec);
+
+		/* don't make it weighter! only 80chars, not weighter. */
+		if (ansi)
+		{
+			mprintf(&string,
+					C_FG_LIGHT_RED "%.2i:%.2i:%.2i" C_OFF C_FG_CYAN " %c"
+					C_OFF " %-35s : ", ts->tm_hour, ts->tm_min, ts->tm_sec,
+					(char) toupper((int) row->type[0]), row->name);
+		}
+		else
+		{
+			mprintf(&string, "%.2i:%.2i:%.2i %c %-35s : ",
+					ts->tm_hour, ts->tm_min, ts->tm_sec,
+					(char) toupper((int) row->type), row->name);
+		}
+
+		if (ansi)
+		{
+			switch (row->is)
+			{
+				case IS_UP:
+					mprintf(&string, C_FG_NEON_GREEN "%s" C_OFF "\n",
+							row->state);
+					break;
+				case IS_DOWN:
+					mprintf(&string, C_FG_LIGHT_BLUE "%s" C_OFF "\n",
+							row->state);
+					break;
+				case IS_FAILED:
+					mprintf(&string, C_FG_LIGHT_RED "%s" C_OFF "\n",
+							row->state);
+					break;
+				case IS_STARTING:
+					mprintf(&string, C_FG_YELLOW "%s" C_OFF "\n", row->state);
+					break;
+				case IS_STOPPING:
+					mprintf(&string, C_FG_CYAN "%s" C_OFF "\n", row->state);
+					break;
+				case IS_WAITING:
+					mprintf(&string, C_FG_MAGENTA "%s" C_OFF "\n",
+							row->state);
+					break;
+				case IS_UNKNOWN:
+					mprintf(&string, "%s\n", row->state);
+					break;
+			}
+		}
+		else
+		{
+			mprintf(&string, "%s\n", row->state);
+		}
 
-	row++;
-    }
-    return (string);
+		row++;
+	}
+	return (string);
 }
 
 
 char *ngc_option_db(reply * rep, int ansi)
 {
-    char *string = NULL;
+	char *string = NULL;
 
-    assert(rep);
-    option_row *row = rep->payload;
-    char ct[20];
-
-    /* print head */
-    if (ansi)
-    {
-	mprintf(&string,
-		" " C_FG_LIGHT_RED "%-10s" C_OFF C_FG_CYAN "%-8s" C_OFF
-		" %-24s %s\n", "Where", "Type", "Name", "Description");
-    }
-    else
-    {
-	mprintf(&string, " %-10s%-8s %-24s %s\n", "Where", "Type", "Name",
-		"Description");
-    }
-
-    mprintf(&string,
-	    " ----------------------------------------------------------------\n");
-
-    while (row->n[0])
-    {
-	switch (row->t)
-	{
-	    case STRING:
-		strcpy(ct, "STRING");
-		break;
-	    case VARIABLE_STRING:
-		strcpy(ct, "V_STRING");
-		break;
-	    case STRINGS:
-		strcpy(ct, "STRINGS");
-		break;
-	    case VARIABLE_STRINGS:
-		strcpy(ct, "V_STRINGS");
-		break;
-	    case SET:
-		strcpy(ct, "SET");
-		break;
-	    case VARIABLE_SET:
-		strcpy(ct, "V_SET");
-		break;
-	    case INT:
-		strcpy(ct, "INT");
-		break;
-	    case VARIABLE_INT:
-		strcpy(ct, "V_INT");
-		break;
-	    case ALIAS:
-		strcpy(ct, "ALIAS");
-		break;
-	    case U_D_T:
-		strcpy(ct, "U_D_T");
-		break;
-	    case TIME_T:
-		strcpy(ct, "TIME_T");
-		break;
-	    case VARIABLE_TIME_T:
-		strcpy(ct, "V_TIME_T");
-		break;
-	}
+	assert(rep);
+	option_row *row = rep->payload;
+	char ct[20];
 
+	/* print head */
 	if (ansi)
 	{
-	    mprintf(&string,
-		    " " C_FG_LIGHT_RED "%-10s" C_OFF C_FG_CYAN "%-8s" C_OFF
-		    " %-24s %s\n", row->o, ct, row->n, row->d);
+		mprintf(&string,
+				" " C_FG_LIGHT_RED "%-10s" C_OFF C_FG_CYAN "%-8s" C_OFF
+				" %-24s %s\n", "Where", "Type", "Name", "Description");
 	}
 	else
 	{
-	    mprintf(&string, " %-10s%-8s %-24s %s\n", row->o, ct, row->n,
-		    row->d);
+		mprintf(&string, " %-10s%-8s %-24s %s\n", "Where", "Type", "Name",
+				"Description");
+	}
+
+	mprintf(&string,
+			" ----------------------------------------------------------------\n");
+
+	while (row->n[0])
+	{
+		switch (row->t)
+		{
+			case STRING:
+				strcpy(ct, "STRING");
+				break;
+			case VARIABLE_STRING:
+				strcpy(ct, "V_STRING");
+				break;
+			case STRINGS:
+				strcpy(ct, "STRINGS");
+				break;
+			case VARIABLE_STRINGS:
+				strcpy(ct, "V_STRINGS");
+				break;
+			case SET:
+				strcpy(ct, "SET");
+				break;
+			case VARIABLE_SET:
+				strcpy(ct, "V_SET");
+				break;
+			case INT:
+				strcpy(ct, "INT");
+				break;
+			case VARIABLE_INT:
+				strcpy(ct, "V_INT");
+				break;
+			case ALIAS:
+				strcpy(ct, "ALIAS");
+				break;
+			case U_D_T:
+				strcpy(ct, "U_D_T");
+				break;
+			case TIME_T:
+				strcpy(ct, "TIME_T");
+				break;
+			case VARIABLE_TIME_T:
+				strcpy(ct, "V_TIME_T");
+				break;
+		}
+
+		if (ansi)
+		{
+			mprintf(&string,
+					" " C_FG_LIGHT_RED "%-10s" C_OFF C_FG_CYAN "%-8s" C_OFF
+					" %-24s %s\n", row->o, ct, row->n, row->d);
+		}
+		else
+		{
+			mprintf(&string, " %-10s%-8s %-24s %s\n", row->o, ct, row->n,
+					row->d);
+		}
+		row++;
 	}
-	row++;
-    }
 
-    /* return the string */
-    return (string);
+	/* return the string */
+	return (string);
 }

Modified: initng/trunk/plugins/ngc4/libngcclient.h
==============================================================================
--- initng/trunk/plugins/ngc4/libngcclient.h	(original)
+++ initng/trunk/plugins/ngc4/libngcclient.h	Wed Apr  5 23:11:19 2006
@@ -25,15 +25,15 @@
 
 typedef struct
 {
-    result_desc result;
-    void *payload;
+	result_desc result;
+	void *payload;
 } reply;
 
 
 #define ngcclient_send_short_command(c, o) ngcclient_send_command(c, NULL, o)
 #define ngcclient_send_long_command(l, o)  ngcclient_send_command('\0', l, o)
 reply *ngcclient_send_command(const char *path, const char c, const char *l,
-			      const char *o);
+							  const char *o);
 
 extern const char *ngcclient_error;
 

Modified: initng/trunk/plugins/ngc4/ngc4.c
==============================================================================
--- initng/trunk/plugins/ngc4/ngc4.c	(original)
+++ initng/trunk/plugins/ngc4/ngc4.c	Wed Apr  5 23:11:19 2006
@@ -73,366 +73,366 @@
 
 static void service_change(nge_event * e, char *service, e_is is, char *state)
 {
-    if (strcmp(service_starting_stopping->name, service) != 0)
-    {
-	/*printf("Dont wanna lissen on \"%s\"\n", service); */
-	return;
-    }
-
-    switch (is)
-    {
-	case IS_UP:
-	    printf("\nService \"%s\" is started!\n", service);
-	    /* Close the event socket, and ngclient_exec() should return */
-	    ngeclient_close_socket(e);
-	    break;
-	case IS_DOWN:
-	    printf("\nService \"%s\" have stopped!\n", service);
-	    /* Close the event socket, and ngclient_exec() should return */
-	    ngeclient_close_socket(e);
-	    break;
-	case IS_FAILED:
-	    printf("\nService \"%s\" have failed!\n", service);
-	    /* Close the event socket, and ngclient_exec() should return */
-	    ngeclient_close_socket(e);
-	    break;
-	default:
-	    printf("\nService \"%s\" is now in state: %s\n", service, state);
-	    break;
-    }
+	if (strcmp(service_starting_stopping->name, service) != 0)
+	{
+		/*printf("Dont wanna lissen on \"%s\"\n", service); */
+		return;
+	}
+
+	switch (is)
+	{
+		case IS_UP:
+			printf("\nService \"%s\" is started!\n", service);
+			/* Close the event socket, and ngclient_exec() should return */
+			ngeclient_close_socket(e);
+			break;
+		case IS_DOWN:
+			printf("\nService \"%s\" have stopped!\n", service);
+			/* Close the event socket, and ngclient_exec() should return */
+			ngeclient_close_socket(e);
+			break;
+		case IS_FAILED:
+			printf("\nService \"%s\" have failed!\n", service);
+			/* Close the event socket, and ngclient_exec() should return */
+			ngeclient_close_socket(e);
+			break;
+		default:
+			printf("\nService \"%s\" is now in state: %s\n", service, state);
+			break;
+	}
 }
 
 
 static void service_output(nge_event * e, char *service, char *process,
-			   char *output)
+						   char *output)
 {
-    if (strcmp(service_starting_stopping->name, service) != 0)
+	if (strcmp(service_starting_stopping->name, service) != 0)
 
-	return;
-    fprintf(stdout, "%s", output);
+		return;
+	fprintf(stdout, "%s", output);
 }
 
 
 static int start_or_stop_command(reply * rep)
 {
-    nge_event e;
+	nge_event e;
+
+	service_starting_stopping = rep->payload;
+
+	/* check what state they are in */
+	switch (service_starting_stopping->is)
+	{
+		case IS_STARTING:
+			print_out("Starting service \"%s\", hang on..\n",
+					  service_starting_stopping->name);
+			break;
+		case IS_STOPPING:
+			print_out("Stopping service \"%s\", hang on..\n\n\n",
+					  service_starting_stopping->name);
+			break;
+		case IS_DOWN:
+			printf("Service %s is already down.\n\n\n",
+				   service_starting_stopping->name);
+			return (FALSE);
+
+		case IS_UP:
+			printf("Service %s is already up.\n",
+				   service_starting_stopping->name);
+			return (FALSE);
+
+		default:
+			print_out("Service has state: %s\n",
+					  service_starting_stopping->state);
+			return (FALSE);
+	}
 
-    service_starting_stopping = rep->payload;
+	/*
+	 * if the state was starting or stopping, start follow
+	 * them by nge.
+	 */
 
-    /* check what state they are in */
-    switch (service_starting_stopping->is)
-    {
-	case IS_STARTING:
-	    print_out("Starting service \"%s\", hang on..\n",
-		      service_starting_stopping->name);
-	    break;
-	case IS_STOPPING:
-	    print_out("Stopping service \"%s\", hang on..\n\n\n",
-		      service_starting_stopping->name);
-	    break;
-	case IS_DOWN:
-	    printf("Service %s is already down.\n\n\n",
-		   service_starting_stopping->name);
-	    return (FALSE);
-
-	case IS_UP:
-	    printf("Service %s is already up.\n",
-		   service_starting_stopping->name);
-	    return (FALSE);
-
-	default:
-	    print_out("Service has state: %s\n",
-		      service_starting_stopping->state);
-	    return (FALSE);
-    }
-
-    /*
-     * if the state was starting or stopping, start follow
-     * them by nge.
-     */
-
-    /* Always null this, to reset it */
-    memset(&e, 0, sizeof(e));
-
-    /* set the hooks */
-    e.service_state_change = &service_change;
-    e.initial_service_state = &service_change;
-    e.service_output = &service_output;
-
-    /* open correct socket */
-    if (debug == TRUE)
-	ngeclient_open_socket(&e, NGE_TEST);
-    else
-	ngeclient_open_socket(&e, NGE_REAL);
-
-    /* if open_socket fails, ngeclient_error is set */
-    if (ngeclient_error)
-    {
-	fprintf(stderr, "%s\n", ngeclient_error);
-	return (FALSE);
-    }
-
-    /* this is the MAIN LOOP for ngeclient */
-    ngeclient_exec(&e);
-
-    /* check for failures */
-    if (ngeclient_error)
-    {
-	fprintf(stderr, "%s\n", ngeclient_error);
-    }
+	/* Always null this, to reset it */
+	memset(&e, 0, sizeof(e));
 
-    return (TRUE);
+	/* set the hooks */
+	e.service_state_change = &service_change;
+	e.initial_service_state = &service_change;
+	e.service_output = &service_output;
+
+	/* open correct socket */
+	if (debug == TRUE)
+		ngeclient_open_socket(&e, NGE_TEST);
+	else
+		ngeclient_open_socket(&e, NGE_REAL);
+
+	/* if open_socket fails, ngeclient_error is set */
+	if (ngeclient_error)
+	{
+		fprintf(stderr, "%s\n", ngeclient_error);
+		return (FALSE);
+	}
+
+	/* this is the MAIN LOOP for ngeclient */
+	ngeclient_exec(&e);
+
+	/* check for failures */
+	if (ngeclient_error)
+	{
+		fprintf(stderr, "%s\n", ngeclient_error);
+	}
+
+	return (TRUE);
 }
 #endif
 
 static int send_and_handle(const char c, const char *l, const char *opt,
-			   int instant)
+						   int instant)
 {
-    char *string = NULL;
-    reply *rep = NULL;
+	char *string = NULL;
+	reply *rep = NULL;
 
 
 
 
-    /*printf("send_and_handle(%c, %s, %s);\n", c, l, opt); */
+	/*printf("send_and_handle(%c, %s, %s);\n", c, l, opt); */
 
 
-    if (debug == TRUE)
-    {
-	rep = ngcclient_send_command(SOCKET_4_FILENAME_TEST, c, l, opt);
-    }
-    else
-    {
-	rep = ngcclient_send_command(SOCKET_4_FILENAME_REAL, c, l, opt);
-    }
-
-    if (ngcclient_error)
-    {
-	print_out("%s\n", ngcclient_error);
-	return (FALSE);
-    }
-
-    if (!rep)
-    {
-	print_out("Command failed.\n");
-	return (FALSE);
-    }
-
-
-    /* print header if not printed before. */
-    /* TODO, put initng version from rep here */
-    if (header_printed == FALSE && quiet == FALSE)
-    {
-	/* print banner */
-	print_out(C_FG_LIGHT_BLUE " Next Generation init Control. version ( "
-		  C_FG_WHITE "%s" C_OFF
-		  C_FG_LIGHT_BLUE " )" C_OFF
-		  C_FG_LIGHT_RED "\n (c) Jimmy Wennlund, " C_OFF
-		  C_FG_NEON_GREEN "http://initng.thinktux.net/" C_OFF,
-		  VERSION);
-	header_printed = TRUE;
-    }
+	if (debug == TRUE)
+	{
+		rep = ngcclient_send_command(SOCKET_4_FILENAME_TEST, c, l, opt);
+	}
+	else
+	{
+		rep = ngcclient_send_command(SOCKET_4_FILENAME_REAL, c, l, opt);
+	}
+
+	if (ngcclient_error)
+	{
+		print_out("%s\n", ngcclient_error);
+		return (FALSE);
+	}
+
+	if (!rep)
+	{
+		print_out("Command failed.\n");
+		return (FALSE);
+	}
+
+
+	/* print header if not printed before. */
+	/* TODO, put initng version from rep here */
+	if (header_printed == FALSE && quiet == FALSE)
+	{
+		/* print banner */
+		print_out(C_FG_LIGHT_BLUE " Next Generation init Control. version ( "
+				  C_FG_WHITE "%s" C_OFF
+				  C_FG_LIGHT_BLUE " )" C_OFF
+				  C_FG_LIGHT_RED "\n (c) Jimmy Wennlund, " C_OFF
+				  C_FG_NEON_GREEN "http://initng.thinktux.net/" C_OFF,
+				  VERSION);
+		header_printed = TRUE;
+	}
 
 
 #ifdef HAVE_NGE
-    if (instant == FALSE && quiet == FALSE)
-    {
-	/*
-	 * there are special commands, where we wanna 
-	 * initziate nge, and follow the service.
-	 */
-	if (rep->result.c == 'u' || rep->result.c == 'd')
+	if (instant == FALSE && quiet == FALSE)
 	{
-	    return (start_or_stop_command(rep));
+		/*
+		 * there are special commands, where we wanna 
+		 * initziate nge, and follow the service.
+		 */
+		if (rep->result.c == 'u' || rep->result.c == 'd')
+		{
+			return (start_or_stop_command(rep));
+		}
 	}
-    }
 #endif
 
-    /* only print when not quiet */
-    if (quiet == FALSE)
-    {
-	string = ngcclient_reply_to_string(rep, TRUE);
-	print_out("\n\n%s\n", string);
-	if (string)
-	    free(string);
-    }
+	/* only print when not quiet */
+	if (quiet == FALSE)
+	{
+		string = ngcclient_reply_to_string(rep, TRUE);
+		print_out("\n\n%s\n", string);
+		if (string)
+			free(string);
+	}
 
-    free(rep);
-    return (TRUE);
+	free(rep);
+	return (TRUE);
 }
 
 /* THIS IS MAIN */
 int main(int argc, char *argv[])
 {
-    int i;
-    int instant = FALSE;
-    int cc = 1;
-    char *Argv = NULL;
-
-    assert(argv[0]);
-
-    /*
-     * Only on first input from initng, we will print a
-     * initng header with version info, after then 
-     * header_printed is true, and probits this.
-     */
-    header_printed = FALSE;
-
-
-
+	int i;
+	int instant = FALSE;
+	int cc = 1;
+	char *Argv = NULL;
 
-    /*
-     * Skip path in Argv.
-     * example argv[0] == "/sbin/ngc" then Argv == "ngc"
-     * example argv[0] == "./ngstart" then Argv == "ngstart"
-     */
-    {
-	i = 0;
+	assert(argv[0]);
 
-	/* skip to last char of "/sbin/ngc" */
-	while (argv[0][i])
-	    i++;
+	/*
+	 * Only on first input from initng, we will print a
+	 * initng header with version info, after then 
+	 * header_printed is true, and probits this.
+	 */
+	header_printed = FALSE;
 
-	/* then walk backwards, to the first '/' found */
-	while (i > 0 && argv[0][i] != '/')
-	{
-	    i--;
-	}
 
-	/* Here we have the program name */
-	Argv = &argv[0][i];
 
-	/* Make sure there is no stale '/' char in beginning */
-	if (Argv[0] == '/')
-	    Argv++;
 
 	/*
-	 * Special case, libtool test adds lt-ngc to path
-	 * when running in make dir.
-	 * So translate "lt-ngc" to "ngc"
+	 * Skip path in Argv.
+	 * example argv[0] == "/sbin/ngc" then Argv == "ngc"
+	 * example argv[0] == "./ngstart" then Argv == "ngstart"
 	 */
-	if (Argv[0] == 'l' && Argv[1] == 't' && Argv[2] == '-')
-	    Argv += 3;
-
-	/* Only for testing.
-	 * printf("Argv: %s argv[0]: %s\n", Argv, argv[0]);
-	 */
-    }
+	{
+		i = 0;
 
-    /* check if cmd-line contains "ngdc", if set debug */
-    if (strncasecmp(Argv, "ngd", 3) == 0)
-    {
-	print_out(C_FG_YELLOW "Warning. This is ngdc!" C_OFF "\n");
-	debug = TRUE;
-    }
-
-
-    if (debug == FALSE && getuid() != 0)
-    {
-	print_out(C_ERROR "You need root access to communicate with initng."
-		  C_OFF "\n");
-	exit(2);
-    }
-
-    /* check that Argc string is not ngc, NGC, ngdc, NGDC */
-    if (strcasecmp(Argv, "ngc") != 0 && strcasecmp(Argv, "ngdc") != 0 &&
-	strcasecmp(Argv, "ngc4") != 0 && strcasecmp(Argv, "ngdc4") != 0)
-    {
-	/*printf("Not standard ngc or ngdc command.\n"); */
-	/* check if argv0 starts with "ng..." */
-	if (Argv[0] == 'n' && Argv[1] == 'g' && Argv[2])
-	{
-	    /* if its ngstart, call send_and_handle("start"); */
-	    if (Argv[2] == 'd' && Argv[3])
-	    {
-		/* check if is a string or char */
-		if (Argv[4])
-		    return (send_and_handle
-			    ('\0', &Argv[3], argv[1], instant));
-		else
-		    return (send_and_handle(Argv[3], NULL, argv[1], instant));
-	    }
-	    else
-	    {
-		/* check if its a string or char */
-		if (Argv[3])
-		    return (send_and_handle
-			    ('\0', &Argv[2], argv[1], instant));
-		else
-		    return (send_and_handle(Argv[2], NULL, argv[1], instant));
-	    }
+		/* skip to last char of "/sbin/ngc" */
+		while (argv[0][i])
+			i++;
+
+		/* then walk backwards, to the first '/' found */
+		while (i > 0 && argv[0][i] != '/')
+		{
+			i--;
+		}
+
+		/* Here we have the program name */
+		Argv = &argv[0][i];
+
+		/* Make sure there is no stale '/' char in beginning */
+		if (Argv[0] == '/')
+			Argv++;
+
+		/*
+		 * Special case, libtool test adds lt-ngc to path
+		 * when running in make dir.
+		 * So translate "lt-ngc" to "ngc"
+		 */
+		if (Argv[0] == 'l' && Argv[1] == 't' && Argv[2] == '-')
+			Argv += 3;
+
+		/* Only for testing.
+		 * printf("Argv: %s argv[0]: %s\n", Argv, argv[0]);
+		 */
 	}
 
-	/* else call standard */
-	return (send_and_handle('\0', Argv, argv[1], instant));
-    }
-
-    /* make sure there are any arguments at all */
-    if (argc <= 1)
-    {
-	send_and_handle('h', NULL, NULL, instant);
-	exit(0);
-    }
+	/* check if cmd-line contains "ngdc", if set debug */
+	if (strncasecmp(Argv, "ngd", 3) == 0)
+	{
+		print_out(C_FG_YELLOW "Warning. This is ngdc!" C_OFF "\n");
+		debug = TRUE;
+	}
 
-    /* walk thru all arguments */
-    while (argv[cc])
-    {
-	char *opt = NULL;
 
-	/* every fresh start needs a '-' char */
-	if (argv[cc][0] != '-')
+	if (debug == FALSE && getuid() != 0)
 	{
-	    send_and_handle('h', NULL, NULL, instant);
-	    exit(1);
+		print_out(C_ERROR "You need root access to communicate with initng."
+				  C_OFF "\n");
+		exit(2);
 	}
 
-	/* check that there is a char after the '-' */
-	if (!argv[cc][1])
+	/* check that Argc string is not ngc, NGC, ngdc, NGDC */
+	if (strcasecmp(Argv, "ngc") != 0 && strcasecmp(Argv, "ngdc") != 0 &&
+		strcasecmp(Argv, "ngc4") != 0 && strcasecmp(Argv, "ngdc4") != 0)
 	{
-	    send_and_handle('h', NULL, NULL, instant);
-	    exit(1);
-	}
+		/*printf("Not standard ngc or ngdc command.\n"); */
+		/* check if argv0 starts with "ng..." */
+		if (Argv[0] == 'n' && Argv[1] == 'g' && Argv[2])
+		{
+			/* if its ngstart, call send_and_handle("start"); */
+			if (Argv[2] == 'd' && Argv[3])
+			{
+				/* check if is a string or char */
+				if (Argv[4])
+					return (send_and_handle
+							('\0', &Argv[3], argv[1], instant));
+				else
+					return (send_and_handle(Argv[3], NULL, argv[1], instant));
+			}
+			else
+			{
+				/* check if its a string or char */
+				if (Argv[3])
+					return (send_and_handle
+							('\0', &Argv[2], argv[1], instant));
+				else
+					return (send_and_handle(Argv[2], NULL, argv[1], instant));
+			}
+		}
 
-	/* if next option contains data, but not starting with an '-', its considered an option */
-	if (argv[cc + 1] && argv[cc + 1][0] != '-')
-	    opt = argv[cc + 1];
+		/* else call standard */
+		return (send_and_handle('\0', Argv, argv[1], instant));
+	}
 
+	/* make sure there are any arguments at all */
+	if (argc <= 1)
+	{
+		send_and_handle('h', NULL, NULL, instant);
+		exit(0);
+	}
 
-	/* if it is an --option */
-	if (argv[cc][1] == '-')
+	/* walk thru all arguments */
+	while (argv[cc])
 	{
+		char *opt = NULL;
 
-	    /* handle local --instant */
-	    if (strcmp(&argv[cc][2], "instant") == 0)
-	    {
-		instant = TRUE;
-		cc++;
-		continue;
-	    }
+		/* every fresh start needs a '-' char */
+		if (argv[cc][0] != '-')
+		{
+			send_and_handle('h', NULL, NULL, instant);
+			exit(1);
+		}
+
+		/* check that there is a char after the '-' */
+		if (!argv[cc][1])
+		{
+			send_and_handle('h', NULL, NULL, instant);
+			exit(1);
+		}
+
+		/* if next option contains data, but not starting with an '-', its considered an option */
+		if (argv[cc + 1] && argv[cc + 1][0] != '-')
+			opt = argv[cc + 1];
+
+
+		/* if it is an --option */
+		if (argv[cc][1] == '-')
+		{
+
+			/* handle local --instant */
+			if (strcmp(&argv[cc][2], "instant") == 0)
+			{
+				instant = TRUE;
+				cc++;
+				continue;
+			}
+
+			/* handle local --quiet */
+			if (strcmp(&argv[cc][2], "quiet") == 0)
+			{
+				quiet = TRUE;
+				cc++;
+				continue;
+			}
+
+			if (!send_and_handle('\0', &argv[cc][2], opt, instant))
+				exit(1);
+		}
+		else
+		{
+			if (!send_and_handle(argv[cc][1], NULL, opt, instant))
+				exit(1);
+		}
 
-	    /* handle local --quiet */
-	    if (strcmp(&argv[cc][2], "quiet") == 0)
-	    {
-		quiet = TRUE;
 		cc++;
-		continue;
-	    }
+		if (opt)
+			cc++;
 
-	    if (!send_and_handle('\0', &argv[cc][2], opt, instant))
-		exit(1);
-	}
-	else
-	{
-	    if (!send_and_handle(argv[cc][1], NULL, opt, instant))
-		exit(1);
-	}
 
-	cc++;
-	if (opt)
-	    cc++;
-
-
-    }
-    print_out("\n\n");
-    exit(0);
+	}
+	print_out("\n\n");
+	exit(0);
 }

Modified: initng/trunk/plugins/ngcs/initng_ngcs.c
==============================================================================
--- initng/trunk/plugins/ngcs/initng_ngcs.c	(original)
+++ initng/trunk/plugins/ngcs/initng_ngcs.c	Wed Apr  5 23:11:19 2006
@@ -73,9 +73,9 @@
 static void ngcs_cmd_compat(ngcs_request * req);
 
 ngcs_cmd ngcs_compat_cmds = {
-    NULL,
-    ngcs_cmd_compat,
-    {0, 0}
+	NULL,
+	ngcs_cmd_compat,
+	{0, 0}
 };
 
 /*
@@ -101,603 +101,603 @@
 
 static void closesock(void)
 {
-    /* Check if we need to remove hooks */
-    if (fdh.fds < 0)
-	return;
-    D_("closesock %d\n", fdh.fds);
+	/* Check if we need to remove hooks */
+	if (fdh.fds < 0)
+		return;
+	D_("closesock %d\n", fdh.fds);
 
-    /* close socket and set to 0 */
-    close(fdh.fds);
-    fdh.fds = -1;
+	/* close socket and set to 0 */
+	close(fdh.fds);
+	fdh.fds = -1;
 }
 
 /* called by fd hook, when data is no socket */
 void accepted_client(f_module_h * from, e_fdw what)
 {
-    int newsock;
-    ngcs_svr_conn *conn;
-    ngcs_chan *chan0;
+	int newsock;
+	ngcs_svr_conn *conn;
+	ngcs_chan *chan0;
 
-    /* In case of lots of short-lived connections */
-    clean_dead_conns();
+	/* In case of lots of short-lived connections */
+	clean_dead_conns();
 
-    /* make a dumb check */
-    if (from != &fdh)
-	return;
+	/* make a dumb check */
+	if (from != &fdh)
+		return;
 
-    D_("Got here from fd hook.\n");
-    /* we try to fix socket after every service start
-       if it fails here chances are a user screwed it
-       up, and we shouldn't manually try to fix anything. */
-    if (fdh.fds <= 0)
-    {
-	/* socket is invalid but we were called, call closesocket to make sure it wont happen again */
-	F_("accepted client called with fdh.fds %d, report bug\n", fdh.fds);
-	closesock();
-	F_("Attempting to reopen socket\n");
-	open_socket();
-	return;
-    }
+	D_("Got here from fd hook.\n");
+	/* we try to fix socket after every service start
+	   if it fails here chances are a user screwed it
+	   up, and we shouldn't manually try to fix anything. */
+	if (fdh.fds <= 0)
+	{
+		/* socket is invalid but we were called, call closesocket to make sure it wont happen again */
+		F_("accepted client called with fdh.fds %d, report bug\n", fdh.fds);
+		closesock();
+		F_("Attempting to reopen socket\n");
+		open_socket();
+		return;
+	}
 
-    /* create a new socket, for reading */
-    if ((newsock = accept(fdh.fds, NULL, NULL)) > 0)
-    {
-	D_("read socket open, now setting options\n");
-	conn = (ngcs_svr_conn *) i_calloc(1, sizeof(ngcs_svr_conn));
-	if (conn == NULL)
-	{
-	    F_("Couldn't allocate ngcs_svr_conn!");
-	    close(newsock);
-	    return;
-	}
-
-	conn->conn = ngcs_conn_from_fd(newsock, conn, &handle_close);
-	if (conn->conn == NULL)
-	{
-	    F_("Couldn't allocate ngcs_conn!");
-	    close(newsock);
-	    free(conn);
-	    return;
-	}
-
-	chan0 = ngcs_chan_reg(conn->conn, 0, &handle_chan0, NULL);
-	if (chan0 == NULL)
-	{
-	    F_("Couldn't register channel 0!");
-	    ngcs_conn_free(conn->conn);
-	    free(conn);
-	    return;
-	}
-
-	conn->fdw.fds = conn->conn->fd;
-	conn->fdw.what = FDW_READ;
-	conn->fdw.call_module = data_ready;
-	conn->nextid = 1;
-	conn->list.next = 0;
-	conn->list.prev = 0;
-	list_add(&conn->list, &ngcs_conns.list);
-	initng_plugin_hook_add(&g.FDWATCHERS, 30, &conn->fdw);
-	return;
-    }
+	/* create a new socket, for reading */
+	if ((newsock = accept(fdh.fds, NULL, NULL)) > 0)
+	{
+		D_("read socket open, now setting options\n");
+		conn = (ngcs_svr_conn *) i_calloc(1, sizeof(ngcs_svr_conn));
+		if (conn == NULL)
+		{
+			F_("Couldn't allocate ngcs_svr_conn!");
+			close(newsock);
+			return;
+		}
+
+		conn->conn = ngcs_conn_from_fd(newsock, conn, &handle_close);
+		if (conn->conn == NULL)
+		{
+			F_("Couldn't allocate ngcs_conn!");
+			close(newsock);
+			free(conn);
+			return;
+		}
+
+		chan0 = ngcs_chan_reg(conn->conn, 0, &handle_chan0, NULL);
+		if (chan0 == NULL)
+		{
+			F_("Couldn't register channel 0!");
+			ngcs_conn_free(conn->conn);
+			free(conn);
+			return;
+		}
+
+		conn->fdw.fds = conn->conn->fd;
+		conn->fdw.what = FDW_READ;
+		conn->fdw.call_module = data_ready;
+		conn->nextid = 1;
+		conn->list.next = 0;
+		conn->list.prev = 0;
+		list_add(&conn->list, &ngcs_conns.list);
+		initng_plugin_hook_add(&g.FDWATCHERS, 30, &conn->fdw);
+		return;
+	}
 
-    /* temporary unavailable */
-    if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
-    {
-	W_("errno = EAGAIN!\n");
-	return;
-    }
+	/* temporary unavailable */
+	if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
+	{
+		W_("errno = EAGAIN!\n");
+		return;
+	}
 
-    /* This'll generally happen on shutdown, don't cry about it. */
-    D_("Error accepting socket %d, %s\n", fdh.fds, strerror(errno));
-    closesock();
-    return;
+	/* This'll generally happen on shutdown, don't cry about it. */
+	D_("Error accepting socket %d, %s\n", fdh.fds, strerror(errno));
+	closesock();
+	return;
 }
 
 static void handle_close(ngcs_conn * conn)
 {
-    ngcs_svr_conn *sconn = (ngcs_svr_conn *) conn->userdata;
+	ngcs_svr_conn *sconn = (ngcs_svr_conn *) conn->userdata;
 
-    initng_plugin_hook_del(&g.FDWATCHERS, &(sconn->fdw));
-    sconn->fdw.fds = -1;
-    list_move(&sconn->list, &ngcs_dead_conns.list);
+	initng_plugin_hook_del(&g.FDWATCHERS, &(sconn->fdw));
+	sconn->fdw.fds = -1;
+	list_move(&sconn->list, &ngcs_dead_conns.list);
 }
 
 static void data_ready(f_module_h * from, e_fdw what)
 {
-    ngcs_svr_conn *conn = (ngcs_svr_conn *) from;
+	ngcs_svr_conn *conn = (ngcs_svr_conn *) from;
 
-    ngcs_conn_data_ready(conn->conn);
-    clean_dead_conns();
+	ngcs_conn_data_ready(conn->conn);
+	clean_dead_conns();
 }
 
 static void handle_chan0(ngcs_chan * chan, int type, int len, char *data)
 {
-    ngcs_request req;
-    ngcs_cmd *cmd;
+	ngcs_request req;
+	ngcs_cmd *cmd;
 
-    /* sanity checks on message */
-    if (len < 0)
-    {
-	return;
-    }
-    else if (type != NGCS_TYPE_STRUCT || len == 0)
-    {
-	F_("Invalid chan0 message with type=%i, len=%i\n", type, len);
-	ngcs_chan_send(chan, NGCS_TYPE_ERROR, 11, "BAD_REQUEST");
-	return;
-    }
+	/* sanity checks on message */
+	if (len < 0)
+	{
+		return;
+	}
+	else if (type != NGCS_TYPE_STRUCT || len == 0)
+	{
+		F_("Invalid chan0 message with type=%i, len=%i\n", type, len);
+		ngcs_chan_send(chan, NGCS_TYPE_ERROR, 11, "BAD_REQUEST");
+		return;
+	}
 
-    /* unpack message */
-    req.argv = NULL;
-    req.argc = ngcs_unpack(data, len, &req.argv);
-    if (req.argc <= 0 || req.argv[0].type != NGCS_TYPE_STRING)
-    {
-	F_("Bad unpacked message\n");
-	if (req.argc >= 0)
-	    free(req.argv);
-	ngcs_chan_send(chan, NGCS_TYPE_ERROR, 11, "BAD_REQUEST");
-	return;
-    }
+	/* unpack message */
+	req.argv = NULL;
+	req.argc = ngcs_unpack(data, len, &req.argv);
+	if (req.argc <= 0 || req.argv[0].type != NGCS_TYPE_STRING)
+	{
+		F_("Bad unpacked message\n");
+		if (req.argc >= 0)
+			free(req.argv);
+		ngcs_chan_send(chan, NGCS_TYPE_ERROR, 11, "BAD_REQUEST");
+		return;
+	}
 
-    req.chan = chan;
-    req.conn = chan->conn;		    /* backwards compatibility */
-    req.sent_resp_flag = 0;
-
-    /* run the associated command */
-    while_ngcs_cmds(cmd)
-    {
-	if (cmd->name != NULL && strcmp(cmd->name, req.argv[0].d.s) == 0)
-	{
-	    cmd->func(&req);
-	    if (!req.sent_resp_flag)
-	    {
-		/* if the command handler didn't send a response,
-		   we send a default one to keep the protocol in sync */
-		ngcs_chan_send(chan, NGCS_TYPE_NULL, 0, NULL);
-	    }
-	    ngcs_free_unpack(req.argc, req.argv);
-	    return;
-	}
-    }
-
-    /* Command handlers which do multiple commands - TODO document this */
-    while_ngcs_cmds(cmd)
-    {
-	if (cmd->name == NULL)
-	{
-	    cmd->func(&req);
-	    if (req.sent_resp_flag)
-	    {
-		ngcs_free_unpack(req.argc, req.argv);
-		return;
-	    }
-	}
-    }
-
-    F_("Unknown ngcs command: %s\n", req.argv[0].d.s);
-    ngcs_chan_send(chan, NGCS_TYPE_ERROR, 17, "COMMAND_NOT_FOUND");
-    ngcs_free_unpack(req.argc, req.argv);
-    return;
+	req.chan = chan;
+	req.conn = chan->conn;					/* backwards compatibility */
+	req.sent_resp_flag = 0;
+
+	/* run the associated command */
+	while_ngcs_cmds(cmd)
+	{
+		if (cmd->name != NULL && strcmp(cmd->name, req.argv[0].d.s) == 0)
+		{
+			cmd->func(&req);
+			if (!req.sent_resp_flag)
+			{
+				/* if the command handler didn't send a response,
+				   we send a default one to keep the protocol in sync */
+				ngcs_chan_send(chan, NGCS_TYPE_NULL, 0, NULL);
+			}
+			ngcs_free_unpack(req.argc, req.argv);
+			return;
+		}
+	}
+
+	/* Command handlers which do multiple commands - TODO document this */
+	while_ngcs_cmds(cmd)
+	{
+		if (cmd->name == NULL)
+		{
+			cmd->func(&req);
+			if (req.sent_resp_flag)
+			{
+				ngcs_free_unpack(req.argc, req.argv);
+				return;
+			}
+		}
+	}
+
+	F_("Unknown ngcs command: %s\n", req.argv[0].d.s);
+	ngcs_chan_send(chan, NGCS_TYPE_ERROR, 17, "COMMAND_NOT_FOUND");
+	ngcs_free_unpack(req.argc, req.argv);
+	return;
 }
 
 static void ngcs_cmd_compat(ngcs_request * req)
 {
-    s_command *cur, *cmd = NULL;
-    int ret;
-    char *arg;
-    char *sret;
+	s_command *cur, *cmd = NULL;
+	int ret;
+	char *arg;
+	char *sret;
 
-    if (req->argv[0].type != NGCS_TYPE_STRING || req->argv[0].d.s[0] != '-')
-	return;
+	if (req->argv[0].type != NGCS_TYPE_STRING || req->argv[0].d.s[0] != '-')
+		return;
 
-    if (req->argv[0].d.s[1] == '-')
-    {
-	while_command_db(cur)
-	{
-	    if (cur->long_id
-		&& strcmp(cur->long_id, req->argv[0].d.s + 2) == 0)
-	    {
-		cmd = cur;
-		break;
-	    }
-	}
-    }
-    else if (req->argv[0].d.s[1] != 0 && req->argv[0].d.s[2] == 0)
-    {
-	while_command_db(cur)
-	{
-	    if (cur->command_id == req->argv[0].d.s[1])
-	    {
-		cmd = cur;
-		break;
-	    }
+	if (req->argv[0].d.s[1] == '-')
+	{
+		while_command_db(cur)
+		{
+			if (cur->long_id
+				&& strcmp(cur->long_id, req->argv[0].d.s + 2) == 0)
+			{
+				cmd = cur;
+				break;
+			}
+		}
+	}
+	else if (req->argv[0].d.s[1] != 0 && req->argv[0].d.s[2] == 0)
+	{
+		while_command_db(cur)
+		{
+			if (cur->command_id == req->argv[0].d.s[1])
+			{
+				cmd = cur;
+				break;
+			}
+		}
 	}
-    }
 
-    if (cmd == NULL)
-	return;
+	if (cmd == NULL)
+		return;
 
-    if (req->argc > 2)
-    {
-	ngcs_send_response(req, NGCS_TYPE_ERROR, 13, "TOO_MANY_ARGS");
-	return;
-    }
+	if (req->argc > 2)
+	{
+		ngcs_send_response(req, NGCS_TYPE_ERROR, 13, "TOO_MANY_ARGS");
+		return;
+	}
 
-    if (req->argc == 2 && req->argv[1].type != NGCS_TYPE_STRING)
-    {
-	ngcs_send_response(req, NGCS_TYPE_ERROR, 8, "BAD_ARGS");
-	return;
-    }
+	if (req->argc == 2 && req->argv[1].type != NGCS_TYPE_STRING)
+	{
+		ngcs_send_response(req, NGCS_TYPE_ERROR, 8, "BAD_ARGS");
+		return;
+	}
 
-    if (cmd->opt_type == NO_OPT && req->argc > 1)
-    {
-	ngcs_send_response(req, NGCS_TYPE_ERROR, 13, "TOO_MANY_ARGS");
-	return;
-    }
+	if (cmd->opt_type == NO_OPT && req->argc > 1)
+	{
+		ngcs_send_response(req, NGCS_TYPE_ERROR, 13, "TOO_MANY_ARGS");
+		return;
+	}
 
-    if (cmd->opt_type == REQUIRES_OPT && req->argc < 2)
-    {
-	ngcs_send_response(req, NGCS_TYPE_ERROR, 12, "TOO_FEW_ARGS");
-	return;
-    }
+	if (cmd->opt_type == REQUIRES_OPT && req->argc < 2)
+	{
+		ngcs_send_response(req, NGCS_TYPE_ERROR, 12, "TOO_FEW_ARGS");
+		return;
+	}
 
-    arg = req->argc > 1 ? req->argv[1].d.s : NULL;
+	arg = req->argc > 1 ? req->argv[1].d.s : NULL;
 
-    switch (cmd->com_type)
-    {
-	case TRUE_OR_FALSE_COMMAND:
-	case INT_COMMAND:
-	    assert(cmd->u.int_command_call);
-
-	    ret = cmd->u.int_command_call(arg);
-	    ngcs_send_response(req, (cmd->com_type == INT_COMMAND ?
-				     NGCS_TYPE_INT : NGCS_TYPE_BOOL),
-			       sizeof(int), (char *) &ret);
-	    break;
-
-	case VOID_COMMAND:
-	    assert(cmd->u.void_command_call);
-	    cmd->u.void_command_call(arg);
-	    ngcs_send_response(req, NGCS_TYPE_NULL, 0, NULL);
-	    break;
-
-	case STRING_COMMAND:
-	    assert(cmd->u.string_command_call);
-	    sret = cmd->u.string_command_call(arg);
-	    if (sret)
-		ngcs_send_response(req, NGCS_TYPE_STRING, strlen(sret), sret);
-	    else
-		ngcs_send_response(req, NGCS_TYPE_NULL, 0, NULL);
-	    break;
-
-	    /* case DATA_COMMAND: - TODO */
-
-	default:
-	    F_("Unknown s_command command type\n");
-	    ngcs_send_response(req, NGCS_TYPE_ERROR, 12, "INTERNAL_ERROR");
-	    return;
+	switch (cmd->com_type)
+	{
+		case TRUE_OR_FALSE_COMMAND:
+		case INT_COMMAND:
+			assert(cmd->u.int_command_call);
+
+			ret = cmd->u.int_command_call(arg);
+			ngcs_send_response(req, (cmd->com_type == INT_COMMAND ?
+									 NGCS_TYPE_INT : NGCS_TYPE_BOOL),
+							   sizeof(int), (char *) &ret);
+			break;
+
+		case VOID_COMMAND:
+			assert(cmd->u.void_command_call);
+			cmd->u.void_command_call(arg);
+			ngcs_send_response(req, NGCS_TYPE_NULL, 0, NULL);
+			break;
+
+		case STRING_COMMAND:
+			assert(cmd->u.string_command_call);
+			sret = cmd->u.string_command_call(arg);
+			if (sret)
+				ngcs_send_response(req, NGCS_TYPE_STRING, strlen(sret), sret);
+			else
+				ngcs_send_response(req, NGCS_TYPE_NULL, 0, NULL);
+			break;
+
+			/* case DATA_COMMAND: - TODO */
+
+		default:
+			F_("Unknown s_command command type\n");
+			ngcs_send_response(req, NGCS_TYPE_ERROR, 12, "INTERNAL_ERROR");
+			return;
 
-    }
+	}
 
-    /* TODO */
+	/* TODO */
 
 }
 
 static void clean_dead_conns(void)
 {
-    ngcs_svr_conn *curr, *tmp;
+	ngcs_svr_conn *curr, *tmp;
 
-    while_ngcs_dead_conns_safe(curr, tmp)
-    {
-	ngcs_conn_free(curr->conn);
-	list_del(&curr->list);
-	free(curr);
-    }
+	while_ngcs_dead_conns_safe(curr, tmp)
+	{
+		ngcs_conn_free(curr->conn);
+		list_del(&curr->list);
+		free(curr);
+	}
 }
 
 ngcs_chan *ngcs_open_channel(ngcs_conn * conn,
-			     void (*gotdata) (ngcs_chan *, int, int,
-					      char *),
-			     void (*chanfree) (ngcs_chan *))
+							 void (*gotdata) (ngcs_chan *, int, int,
+											  char *),
+							 void (*chanfree) (ngcs_chan *))
 {
-    ngcs_svr_conn *sconn = (ngcs_svr_conn *) conn->userdata;
+	ngcs_svr_conn *sconn = (ngcs_svr_conn *) conn->userdata;
 
-    return ngcs_chan_reg(conn, sconn->nextid++, gotdata, chanfree);
+	return ngcs_chan_reg(conn, sconn->nextid++, gotdata, chanfree);
 }
 
 void ngcs_close_channel(ngcs_chan * chan)
 {
-    ngcs_chan_send(chan, NGCS_TYPE_NULL, -1, NULL);
-    ngcs_chan_del(chan);
+	ngcs_chan_send(chan, NGCS_TYPE_NULL, -1, NULL);
+	ngcs_chan_del(chan);
 }
 
 int ngcs_send_response(ngcs_request * req, int type, int len,
-		       const char *data)
+					   const char *data)
 {
-    assert(req);
-    if (req->sent_resp_flag)
-	return 1;
-    req->sent_resp_flag = 1;
-    return ngcs_chan_send(req->chan, type, len, data);
+	assert(req);
+	if (req->sent_resp_flag)
+		return 1;
+	req->sent_resp_flag = 1;
+	return ngcs_chan_send(req->chan, type, len, data);
 }
 
 void ngcs_reg_cmd(ngcs_cmd * cmd)
 {
-    cmd->list.prev = 0;
-    cmd->list.next = 0;
-    list_add(&cmd->list, &ngcs_cmds.list);
+	cmd->list.prev = 0;
+	cmd->list.next = 0;
+	list_add(&cmd->list, &ngcs_cmds.list);
 }
 
 void ngcs_unreg_cmd(ngcs_cmd * cmd)
 {
-    assert(cmd);
-    assert(cmd->list.prev);
-    assert(cmd->list.next);
-    list_del(&cmd->list);
+	assert(cmd);
+	assert(cmd->list.prev);
+	assert(cmd->list.next);
+	list_del(&cmd->list);
 }
 
 #if 0
 /* Send a ping to ourselves to check if we're 100% ok. */
 static int sendping()
 {
-    int client;
-    struct sockaddr_un sockname;
-    data_header head;
-
-    D_("Sending ping\n");
-
-
-    /* Create the socket. */
-    client = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (client < 0)
-    {
-	F_("Failed to init socket\n");
-	return FALSE;
-    }
-
-    /* Bind a name to the socket. */
-    sockname.sun_family = AF_UNIX;
-
-    strcpy(sockname.sun_path, socket_filename);
-
-    /* Try to connect */
-    if (connect
-	(client, (struct sockaddr *) &sockname,
-	 (strlen(sockname.sun_path) + sizeof(sockname.sun_family))) < 0)
-    {
-	close(client);
-	return FALSE;
-    }
-
-    D_("Sending PING..\n");
-    if (ngcs_sendmsg(NGCS_PING, 0, 123, NULL, 0)) ;
-    {
-	F_("Unable to send PING!\n");
-	close(client);
-	return (FALSE);
-    }
-    D_("PING sent..\n");
-
-    /* Accept "server side" */
-    accepted_client(&fdh);
-    /* FIXME: won't work anymore */
-
-    D_("Reading PONG..\n");
-    if (ngcs_recvall(client, &head, sizeof(head)))
-    {
-	F_("Unable to receive PONG!\n");
-	close(client);
-	return (FALSE);
-    }
+	int client;
+	struct sockaddr_un sockname;
+	data_header head;
+
+	D_("Sending ping\n");
 
-    D_("Got pong\n");
 
-    return TRUE;
+	/* Create the socket. */
+	client = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (client < 0)
+	{
+		F_("Failed to init socket\n");
+		return FALSE;
+	}
+
+	/* Bind a name to the socket. */
+	sockname.sun_family = AF_UNIX;
+
+	strcpy(sockname.sun_path, socket_filename);
+
+	/* Try to connect */
+	if (connect
+		(client, (struct sockaddr *) &sockname,
+		 (strlen(sockname.sun_path) + sizeof(sockname.sun_family))) < 0)
+	{
+		close(client);
+		return FALSE;
+	}
+
+	D_("Sending PING..\n");
+	if (ngcs_sendmsg(NGCS_PING, 0, 123, NULL, 0)) ;
+	{
+		F_("Unable to send PING!\n");
+		close(client);
+		return (FALSE);
+	}
+	D_("PING sent..\n");
+
+	/* Accept "server side" */
+	accepted_client(&fdh);
+	/* FIXME: won't work anymore */
+
+	D_("Reading PONG..\n");
+	if (ngcs_recvall(client, &head, sizeof(head)))
+	{
+		F_("Unable to receive PONG!\n");
+		close(client);
+		return (FALSE);
+	}
+
+	D_("Got pong\n");
+
+	return TRUE;
 }
 #endif
 
 /* this will try to open a new socket */
 static int open_socket()
 {
-    /*    int flags; */
-    struct sockaddr_un serv_sockname;
+	/*    int flags; */
+	struct sockaddr_un serv_sockname;
 
-    D_("Creating " SOCKET_ROOTPATH " dir\n");
+	D_("Creating " SOCKET_ROOTPATH " dir\n");
 
-    closesock();
+	closesock();
 
-    /* Make /dev/initng if it doesn't exist (try either way) */
-    if (mkdir(SOCKET_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1
-	&& errno != EEXIST)
-    {
-	if (errno != EROFS)
-	    F_("Could not create " SOCKET_ROOTPATH
-	       " : %s, may be / fs not mounted read-write yet?, will retry until I succeed.\n",
-	       strerror(errno));
-	return (FALSE);
-    }
-
-    /* chmod root path for root use only */
-    if (chmod(SOCKET_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
-    {
-	/* path doesn't exist, we don't have /dev yet. */
-	if (errno == ENOENT || errno == EROFS)
-	    return (FALSE);
-
-	F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
-	   SOCKET_ROOTPATH);
-    }
-
-    /* Create the socket. */
-    fdh.fds = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (fdh.fds < 1)
-    {
-	F_("Failed to init socket (%s)\n", strerror(errno));
-	fdh.fds = -1;
-	return (FALSE);
-    }
+	/* Make /dev/initng if it doesn't exist (try either way) */
+	if (mkdir(SOCKET_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1
+		&& errno != EEXIST)
+	{
+		if (errno != EROFS)
+			F_("Could not create " SOCKET_ROOTPATH
+			   " : %s, may be / fs not mounted read-write yet?, will retry until I succeed.\n",
+			   strerror(errno));
+		return (FALSE);
+	}
 
-    /* Bind a name to the socket. */
-    serv_sockname.sun_family = AF_UNIX;
+	/* chmod root path for root use only */
+	if (chmod(SOCKET_ROOTPATH, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
+	{
+		/* path doesn't exist, we don't have /dev yet. */
+		if (errno == ENOENT || errno == EROFS)
+			return (FALSE);
 
-    strcpy(serv_sockname.sun_path, socket_filename);
+		F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
+		   SOCKET_ROOTPATH);
+	}
 
-    /* Remove old socket file if any */
-    unlink(serv_sockname.sun_path);
-
-    /* Try to bind */
-    if (bind
-	(fdh.fds, (struct sockaddr *) &serv_sockname,
-	 (strlen(serv_sockname.sun_path) +
-	  sizeof(serv_sockname.sun_family))) < 0)
-    {
-	F_("Error binding to socket (errno: %d str: '%s')\n", errno,
-	   strerror(errno));
-	closesock();
-	unlink(serv_sockname.sun_path);
-	return (FALSE);
-    }
+	/* Create the socket. */
+	fdh.fds = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (fdh.fds < 1)
+	{
+		F_("Failed to init socket (%s)\n", strerror(errno));
+		fdh.fds = -1;
+		return (FALSE);
+	}
 
-    /* chmod socket for root only use */
-    if (chmod(serv_sockname.sun_path, S_IRUSR | S_IWUSR) == -1)
-    {
-	F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
-	   serv_sockname.sun_path);
-	closesock();
-	return (FALSE);
-    }
+	/* Bind a name to the socket. */
+	serv_sockname.sun_family = AF_UNIX;
 
-    /* store sock_stat for checking if we need to recreate socket later */
-    stat(serv_sockname.sun_path, &sock_stat);
+	strcpy(serv_sockname.sun_path, socket_filename);
 
-    /* Listen to socket */
-    if (listen(fdh.fds, 5))
-    {
-	F_("Error on listen (errno: %d str: '%s')\n", errno, strerror(errno));
-	closesock();
+	/* Remove old socket file if any */
 	unlink(serv_sockname.sun_path);
-	return (FALSE);
-    }
 
-    /* Run check : */
-    /*    if (!sendping())
-       {
-       F_("Sendping check failed, ngcs communication not available (if you see this open a bug)\n");
-       closesock();
-       return (FALSE);
-       } */
+	/* Try to bind */
+	if (bind
+		(fdh.fds, (struct sockaddr *) &serv_sockname,
+		 (strlen(serv_sockname.sun_path) +
+		  sizeof(serv_sockname.sun_family))) < 0)
+	{
+		F_("Error binding to socket (errno: %d str: '%s')\n", errno,
+		   strerror(errno));
+		closesock();
+		unlink(serv_sockname.sun_path);
+		return (FALSE);
+	}
+
+	/* chmod socket for root only use */
+	if (chmod(serv_sockname.sun_path, S_IRUSR | S_IWUSR) == -1)
+	{
+		F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
+		   serv_sockname.sun_path);
+		closesock();
+		return (FALSE);
+	}
 
-    return (TRUE);
+	/* store sock_stat for checking if we need to recreate socket later */
+	stat(serv_sockname.sun_path, &sock_stat);
+
+	/* Listen to socket */
+	if (listen(fdh.fds, 5))
+	{
+		F_("Error on listen (errno: %d str: '%s')\n", errno, strerror(errno));
+		closesock();
+		unlink(serv_sockname.sun_path);
+		return (FALSE);
+	}
+
+	/* Run check : */
+	/*    if (!sendping())
+	   {
+	   F_("Sendping check failed, ngcs communication not available (if you see this open a bug)\n");
+	   closesock();
+	   return (FALSE);
+	   } */
+
+	return (TRUE);
 }
 
 /* this will check socket, and reopen on failure */
 static void check_socket()
 {
-    struct stat st;
+	struct stat st;
 
-    D_("Checking socket\n");
+	D_("Checking socket\n");
 
-    /* Check if socket needs reopening */
-    if (fdh.fds <= 0)
-    {
-	D_("fdh.fds not set, opening new socket.\n");
-	open_socket();
-	return;
-    }
+	/* Check if socket needs reopening */
+	if (fdh.fds <= 0)
+	{
+		D_("fdh.fds not set, opening new socket.\n");
+		open_socket();
+		return;
+	}
 
-    /* stat the socket, reopen on failure */
-    memset(&st, 0, sizeof(st));
-    if (stat(socket_filename, &st) < 0)
-    {
-	W_("Stat failed! Opening new socket.\n");
-	open_socket();
-	return;
-    }
+	/* stat the socket, reopen on failure */
+	memset(&st, 0, sizeof(st));
+	if (stat(socket_filename, &st) < 0)
+	{
+		W_("Stat failed! Opening new socket.\n");
+		open_socket();
+		return;
+	}
 
-    /* compare socket file, with the one that we know, reopen on failure */
-    if (st.st_dev != sock_stat.st_dev || st.st_ino != sock_stat.st_ino
-	|| st.st_mtime != sock_stat.st_mtime)
-    {
-	F_("Invalid socket found, reopening\n");
-	open_socket();
-	return;
-    }
+	/* compare socket file, with the one that we know, reopen on failure */
+	if (st.st_dev != sock_stat.st_dev || st.st_ino != sock_stat.st_ino
+		|| st.st_mtime != sock_stat.st_mtime)
+	{
+		F_("Invalid socket found, reopening\n");
+		open_socket();
+		return;
+	}
 
-    D_("Socket ok.\n");
-    return;
+	D_("Socket ok.\n");
+	return;
 }
 
 /* this function, will make a check for socket, on every new service that goes up */
 int service_status(active_db_h * service)
 {
-    /* only try open, when a service got up */
-    if (IS_UP(service))
-	check_socket();
+	/* only try open, when a service got up */
+	if (IS_UP(service))
+		check_socket();
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init(ngcs);\n");
+	D_("module_init(ngcs);\n");
+
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	/* zero globals */
+	fdh.fds = -1;
+	memset(&sock_stat, 0, sizeof(sock_stat));
+	INIT_LIST_HEAD(&ngcs_conns.list);
+	INIT_LIST_HEAD(&ngcs_dead_conns.list);
+	INIT_LIST_HEAD(&ngcs_cmds.list);
+
+	/* decide which socket to use */
+	if (g.i_am_init)
+		socket_filename = SOCKET_FILENAME_REAL;
+	else
+		socket_filename = SOCKET_FILENAME_TEST;
+	D_("Socket is: %s\n", socket_filename);
+
+	D_("adding hook, that will reopen socket, for every started service.\n");
+	initng_plugin_hook_add(&g.IS_CHANGE, 50, &service_status);
+	initng_plugin_hook_add(&g.FDWATCHERS, 30, &fdh);
 
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    /* zero globals */
-    fdh.fds = -1;
-    memset(&sock_stat, 0, sizeof(sock_stat));
-    INIT_LIST_HEAD(&ngcs_conns.list);
-    INIT_LIST_HEAD(&ngcs_dead_conns.list);
-    INIT_LIST_HEAD(&ngcs_cmds.list);
-
-    /* decide which socket to use */
-    if (g.i_am_init)
-	socket_filename = SOCKET_FILENAME_REAL;
-    else
-	socket_filename = SOCKET_FILENAME_TEST;
-    D_("Socket is: %s\n", socket_filename);
-
-    D_("adding hook, that will reopen socket, for every started service.\n");
-    initng_plugin_hook_add(&g.IS_CHANGE, 50, &service_status);
-    initng_plugin_hook_add(&g.FDWATCHERS, 30, &fdh);
-
-    ngcs_reg_cmd(&ngcs_compat_cmds);
+	ngcs_reg_cmd(&ngcs_compat_cmds);
 
-    register_ngcs_cmds();
+	register_ngcs_cmds();
 
-    /* do the first socket directly */
-    open_socket();
+	/* do the first socket directly */
+	open_socket();
 
-    D_("ngcs.so.0.0 loaded!\n");
-    return (TRUE);
+	D_("ngcs.so.0.0 loaded!\n");
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    ngcs_svr_conn *curr, *tmp;
+	ngcs_svr_conn *curr, *tmp;
 
-    D_("module_unload(ngcs);\n");
+	D_("module_unload(ngcs);\n");
 
-    /* close open sockets */
-    closesock();
-    while_ngcs_conns_safe(curr, tmp)
-    {
-	ngcs_conn_free(curr->conn);
-    }
-    clean_dead_conns();
+	/* close open sockets */
+	closesock();
+	while_ngcs_conns_safe(curr, tmp)
+	{
+		ngcs_conn_free(curr->conn);
+	}
+	clean_dead_conns();
 
-    ngcs_unreg_cmd(&ngcs_compat_cmds);
+	ngcs_unreg_cmd(&ngcs_compat_cmds);
 
-    unregister_ngcs_cmds();
+	unregister_ngcs_cmds();
 
-    /* remove hooks */
-    initng_plugin_hook_del(&g.FDWATCHERS, &fdh);
-    initng_plugin_hook_del(&g.IS_CHANGE, &service_status);
+	/* remove hooks */
+	initng_plugin_hook_del(&g.FDWATCHERS, &fdh);
+	initng_plugin_hook_del(&g.IS_CHANGE, &service_status);
 
-    D_("ngcs.so.0.0 unloaded!\n");
+	D_("ngcs.so.0.0 unloaded!\n");
 
 }

Modified: initng/trunk/plugins/ngcs/initng_ngcs.h
==============================================================================
--- initng/trunk/plugins/ngcs/initng_ngcs.h	(original)
+++ initng/trunk/plugins/ngcs/initng_ngcs.h	Wed Apr  5 23:11:19 2006
@@ -81,9 +81,9 @@
  * \sa ngcs_chan_reg
  */
 ngcs_chan *ngcs_open_channel(ngcs_conn * conn,
-			     void (*gotdata) (ngcs_chan *, int, int,
-					      char *),
-			     void (*chanfree) (ngcs_chan *));
+							 void (*gotdata) (ngcs_chan *, int, int,
+											  char *),
+							 void (*chanfree) (ngcs_chan *));
 
 /* \brief Send a response to a request
  *
@@ -99,7 +99,7 @@
  * \sa ngcs_sendmsg() ngcs_cmd
  */
 int ngcs_send_response(ngcs_request * req, int type, int len,
-		       const char *data);
+					   const char *data);
 
 /*! \brief Ngcs command handler
  *
@@ -110,36 +110,36 @@
  */
 struct ngcs_cmd_s
 {
-    /*! \brief Name of the command */
-    const char *name;
+	/*! \brief Name of the command */
+	const char *name;
 
-    /*! \brief Callback function to handle the request
-     *
-     *  The callback function to handle the request. It should call  ngcs_send_response
-     *  exactly once to send a response to the request.
-     *  \sa ngcs_send_response()
-     */
-    void (*func) (ngcs_request * req);
+	/*! \brief Callback function to handle the request
+	 *
+	 *  The callback function to handle the request. It should call  ngcs_send_response
+	 *  exactly once to send a response to the request.
+	 *  \sa ngcs_send_response()
+	 */
+	void (*func) (ngcs_request * req);
 
-    /* \brief List head - internal use */
-    struct list_head list;
+	/* \brief List head - internal use */
+	struct list_head list;
 };
 
 struct ngcs_request_s
 {
-    int argc;
-    ngcs_data *argv;
-    ngcs_chan *chan;
-    ngcs_conn *conn;
-    int sent_resp_flag;
+	int argc;
+	ngcs_data *argv;
+	ngcs_chan *chan;
+	ngcs_conn *conn;
+	int sent_resp_flag;
 };
 
 struct ngcs_svr_conn_s
 {
-    f_module_h fdw;
-    int nextid;
-    ngcs_conn *conn;
-    struct list_head list;
+	f_module_h fdw;
+	int nextid;
+	ngcs_conn *conn;
+	struct list_head list;
 };
 
 extern ngcs_svr_conn ngcs_conns;

Modified: initng/trunk/plugins/ngcs/initng_ngcs_cmds.c
==============================================================================
--- initng/trunk/plugins/ngcs/initng_ngcs_cmds.c	(original)
+++ initng/trunk/plugins/ngcs/initng_ngcs_cmds.c	Wed Apr  5 23:11:19 2006
@@ -59,16 +59,16 @@
 
 typedef struct ngcs_watch_s
 {
-    ngcs_chan *chan;
-    char *name;
-    int flags;
-    struct list_head list;
+	ngcs_chan *chan;
+	char *name;
+	int flags;
+	struct list_head list;
 } ngcs_watch;
 
 typedef struct ngcs_genwatch_s
 {
-    ngcs_chan *chan;
-    struct list_head list;
+	ngcs_chan *chan;
+	struct list_head list;
 } ngcs_genwatch;
 
 void register_ngcs_cmds(void);
@@ -77,7 +77,7 @@
 static void ngcs_cmd_watch(ngcs_request * req);
 static void ngcs_free_watch(ngcs_chan * chan);
 static int service_output_watch(active_db_h * service, process_h * x,
-				char *buffer_pos);
+								char *buffer_pos);
 static ngcs_watch *ngcs_add_watch(ngcs_conn * conn, char *svcname, int flags);
 static void ngcs_cmd_start(ngcs_request * req);
 static int ngcs_watch_initial(ngcs_watch * watch);
@@ -89,62 +89,62 @@
 static void ngcs_cmd_swatch(ngcs_request * req);
 static void ngcs_cmd_ewatch(ngcs_request * req);
 static int error_watch(e_mt mt, const char *file, const char *func,
-		       int line, const char *format, va_list arg);
+					   int line, const char *format, va_list arg);
 
 ngcs_cmd ngcs_start_cmd = {
-    "start",
-    ngcs_cmd_start,
-    {0, 0}
+	"start",
+	ngcs_cmd_start,
+	{0, 0}
 };
 
 
 ngcs_cmd ngcs_stop_cmd = {
-    "stop",
-    ngcs_cmd_stop,
-    {0, 0}
+	"stop",
+	ngcs_cmd_stop,
+	{0, 0}
 };
 
 ngcs_cmd ngcs_watch_cmd = {
-    "watch",
-    ngcs_cmd_watch,
-    {0, 0}
+	"watch",
+	ngcs_cmd_watch,
+	{0, 0}
 };
 
 ngcs_cmd ngcs_swatch_cmd = {
-    "swatch",
-    ngcs_cmd_swatch,
-    {0, 0}
+	"swatch",
+	ngcs_cmd_swatch,
+	{0, 0}
 };
 
 ngcs_cmd ngcs_ewatch_cmd = {
-    "ewatch",
-    ngcs_cmd_ewatch,
-    {0, 0}
+	"ewatch",
+	ngcs_cmd_ewatch,
+	{0, 0}
 };
 
 /* TODO - remove this. It's obsolete */
 ngcs_cmd ngcs_hot_reload_cmd = {
-    "hot_reload",
-    ngcs_cmd_hot_reload,
-    {0, 0}
+	"hot_reload",
+	ngcs_cmd_hot_reload,
+	{0, 0}
 };
 
 ngcs_cmd ngcs_hot_reload_cmd_short = {
-    "-c",
-    ngcs_cmd_hot_reload,
-    {0, 0}
+	"-c",
+	ngcs_cmd_hot_reload,
+	{0, 0}
 };
 
 ngcs_cmd ngcs_hot_reload_cmd_long = {
-    "--hot_reload",
-    ngcs_cmd_hot_reload,
-    {0, 0}
+	"--hot_reload",
+	ngcs_cmd_hot_reload,
+	{0, 0}
 };
 
 ngcs_cmd ngcs_zap_cmd = {
-    "zap",
-    ngcs_cmd_zap,
-    {0, 0}
+	"zap",
+	ngcs_cmd_zap,
+	{0, 0}
 };
 
 ngcs_watch watches;
@@ -153,453 +153,453 @@
 
 static void system_state_watch(e_is state)
 {
-    ngcs_genwatch *watch, *nextwatch;
-    int i = state;
+	ngcs_genwatch *watch, *nextwatch;
+	int i = state;
 
-    list_for_each_entry_prev_safe(watch, nextwatch, &swatches.list, list)
-    {
-	ngcs_chan_send(watch->chan, NGCS_TYPE_INT, sizeof(int), (char *) &i);
-    }
+	list_for_each_entry_prev_safe(watch, nextwatch, &swatches.list, list)
+	{
+		ngcs_chan_send(watch->chan, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+	}
 }
 
 static int error_watch(e_mt mt, const char *file, const char *func,
-		       int line, const char *format, va_list arg)
+					   int line, const char *format, va_list arg)
 {
-    ngcs_genwatch *watch, *nextwatch;
-    int len, size;
-    ngcs_data dat[5];
-    char *buf;
+	ngcs_genwatch *watch, *nextwatch;
+	int len, size;
+	ngcs_data dat[5];
+	char *buf;
 
 
-    /* Don't do the processing if we're just going to throw away the result */
-    if (list_empty(&ewatches.list))
-	return FALSE;
+	/* Don't do the processing if we're just going to throw away the result */
+	if (list_empty(&ewatches.list))
+		return FALSE;
 
-    dat[0].type = NGCS_TYPE_INT;
-    dat[0].d.i = mt;
-    dat[1].type = NGCS_TYPE_STRING;
-    dat[1].len = -1;
-    dat[1].d.s = (char *) file;
-    dat[2].type = NGCS_TYPE_STRING;
-    dat[2].len = -1;
-    dat[2].d.s = (char *) func;
-    dat[3].type = NGCS_TYPE_INT;
-    dat[3].d.i = line;
-
-    dat[4].type = NGCS_TYPE_STRING;
-
-    size = 256;
-    dat[4].d.s = i_calloc(1, size);
-    len = vsnprintf(dat[4].d.s, 256, format, arg);
-    while (len < 0 || len >= size)
-    {
-	/* Some glibc versions apparently return -1 if buffer too small */
-	size = (len < 0 ? size * 2 : len + 1);
-	free(dat[4].d.s);
+	dat[0].type = NGCS_TYPE_INT;
+	dat[0].d.i = mt;
+	dat[1].type = NGCS_TYPE_STRING;
+	dat[1].len = -1;
+	dat[1].d.s = (char *) file;
+	dat[2].type = NGCS_TYPE_STRING;
+	dat[2].len = -1;
+	dat[2].d.s = (char *) func;
+	dat[3].type = NGCS_TYPE_INT;
+	dat[3].d.i = line;
+
+	dat[4].type = NGCS_TYPE_STRING;
+
+	size = 256;
 	dat[4].d.s = i_calloc(1, size);
 	len = vsnprintf(dat[4].d.s, 256, format, arg);
-    }
-    dat[4].len = len;
+	while (len < 0 || len >= size)
+	{
+		/* Some glibc versions apparently return -1 if buffer too small */
+		size = (len < 0 ? size * 2 : len + 1);
+		free(dat[4].d.s);
+		dat[4].d.s = i_calloc(1, size);
+		len = vsnprintf(dat[4].d.s, 256, format, arg);
+	}
+	dat[4].len = len;
+
+	len = ngcs_pack(dat, 5, NULL);
+	assert(len >= 0);
+	buf = i_calloc(1, len);
+	assert(buf);							/* should always succeed */
+	len = ngcs_pack(dat, 5, buf);
+	assert(len >= 0);
+
+	list_for_each_entry_prev_safe(watch, nextwatch, &ewatches.list, list)
+	{
+		ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf);
+	}
 
-    len = ngcs_pack(dat, 5, NULL);
-    assert(len >= 0);
-    buf = i_calloc(1, len);
-    assert(buf);			    /* should always succeed */
-    len = ngcs_pack(dat, 5, buf);
-    assert(len >= 0);
-
-    list_for_each_entry_prev_safe(watch, nextwatch, &ewatches.list, list)
-    {
-	ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf);
-    }
-
-    free(dat[4].d.s);
-    free(buf);
-    return FALSE;
+	free(dat[4].d.s);
+	free(buf);
+	return FALSE;
 }
 
 static int service_status_watch(active_db_h * service)
 {
-    ngcs_watch *watch, *nextwatch;
-    int len = 0;
-    char *buf = NULL;
-
-    len = ngcs_marshal_active_db_h(service, NULL);
-    list_for_each_entry_prev_safe(watch, nextwatch, &watches.list, list)
-    {
-	if ((watch->flags & NGCS_WATCH_STATUS) &&
-	    (watch->name == NULL || strcmp(watch->name, service->name) == 0))
-	{
-	    if (!buf)
-	    {
-		buf = i_calloc(1, len);
-		len = ngcs_marshal_active_db_h(service, buf);
-		if (len < 0)
+	ngcs_watch *watch, *nextwatch;
+	int len = 0;
+	char *buf = NULL;
+
+	len = ngcs_marshal_active_db_h(service, NULL);
+	list_for_each_entry_prev_safe(watch, nextwatch, &watches.list, list)
+	{
+		if ((watch->flags & NGCS_WATCH_STATUS) &&
+			(watch->name == NULL || strcmp(watch->name, service->name) == 0))
 		{
-		    F_("ngcs_marshal_active_db_h() failed!\n");
-		    free(buf);
-		    return TRUE;
+			if (!buf)
+			{
+				buf = i_calloc(1, len);
+				len = ngcs_marshal_active_db_h(service, buf);
+				if (len < 0)
+				{
+					F_("ngcs_marshal_active_db_h() failed!\n");
+					free(buf);
+					return TRUE;
+				}
+			}
+			ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf);
 		}
-	    }
-	    ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf);
 	}
-    }
-    if (buf)
-	free(buf);
-    return TRUE;
+	if (buf)
+		free(buf);
+	return TRUE;
 }
 
 static int ngcs_watch_initial(ngcs_watch * watch)
 {
-    if (watch->flags & NGCS_CURRENT_STATUS)
-    {
-	active_db_h *current;
-
-	current = NULL;
-	while_active_db(current)
-	{
-	    if (watch->name == NULL
-		|| strcmp(watch->name, current->name) == 0)
-	    {
-		int len = 0;
-		char *buf = NULL;
-
-		len = ngcs_marshal_active_db_h(current, NULL);
-		buf = i_calloc(1, len);
-		len = ngcs_marshal_active_db_h(current, buf);
-		if (len < 0)
+	if (watch->flags & NGCS_CURRENT_STATUS)
+	{
+		active_db_h *current;
+
+		current = NULL;
+		while_active_db(current)
 		{
-		    F_("ngcs_marshal_active_db_h() failed!\n");
-		    free(buf);
-		    return 1;
+			if (watch->name == NULL
+				|| strcmp(watch->name, current->name) == 0)
+			{
+				int len = 0;
+				char *buf = NULL;
+
+				len = ngcs_marshal_active_db_h(current, NULL);
+				buf = i_calloc(1, len);
+				len = ngcs_marshal_active_db_h(current, buf);
+				if (len < 0)
+				{
+					F_("ngcs_marshal_active_db_h() failed!\n");
+					free(buf);
+					return 1;
+				}
+				if (ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf))
+				{
+					free(buf);
+					return 1;
+				};
+				free(buf);
+			}
 		}
-		if (ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf))
-		{
-		    free(buf);
-		    return 1;
-		};
-		free(buf);
-	    }
 	}
-    }
 
-    if (ngcs_chan_send(watch->chan, NGCS_TYPE_NULL, 0, NULL))
-	return 1;
+	if (ngcs_chan_send(watch->chan, NGCS_TYPE_NULL, 0, NULL))
+		return 1;
 
-    return 0;
+	return 0;
 }
 
 static int service_output_watch(active_db_h * service, process_h * x,
-				char *buffer_pos)
+								char *buffer_pos)
 {
-    ngcs_watch *watch, *nextwatch;
-    ngcs_data dat[2];
-    int len = 0;
-    char *buf = NULL;;
-
-    dat[0].type = NGCS_TYPE_STRING;
-    dat[0].len = -1;
-    dat[0].d.s = service->name;
-    dat[1].type = NGCS_TYPE_STRING;
-    dat[1].len = -1;
-    dat[1].d.s = buffer_pos;
-
-    list_for_each_entry_prev_safe(watch, nextwatch, &watches.list, list)
-    {
-	if ((watch->flags & NGCS_WATCH_OUTPUT) &&
-	    (watch->name == NULL || strcmp(watch->name, service->name) == 0))
-	{
-	    if (!buf)
-	    {
-		len = ngcs_pack(dat, 2, NULL);
-		assert(len >= 0);
-		buf = i_calloc(1, len);
-		len = ngcs_pack(dat, 2, buf);
-		assert(len >= 0);
-	    }
-	    if (ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf))
-	    {
-		free(buf);
-		return FALSE;
-	    };
+	ngcs_watch *watch, *nextwatch;
+	ngcs_data dat[2];
+	int len = 0;
+	char *buf = NULL;;
+
+	dat[0].type = NGCS_TYPE_STRING;
+	dat[0].len = -1;
+	dat[0].d.s = service->name;
+	dat[1].type = NGCS_TYPE_STRING;
+	dat[1].len = -1;
+	dat[1].d.s = buffer_pos;
+
+	list_for_each_entry_prev_safe(watch, nextwatch, &watches.list, list)
+	{
+		if ((watch->flags & NGCS_WATCH_OUTPUT) &&
+			(watch->name == NULL || strcmp(watch->name, service->name) == 0))
+		{
+			if (!buf)
+			{
+				len = ngcs_pack(dat, 2, NULL);
+				assert(len >= 0);
+				buf = i_calloc(1, len);
+				len = ngcs_pack(dat, 2, buf);
+				assert(len >= 0);
+			}
+			if (ngcs_chan_send(watch->chan, NGCS_TYPE_STRUCT, len, buf))
+			{
+				free(buf);
+				return FALSE;
+			};
+		}
 	}
-    }
-    if (buf)
-	free(buf);
-    return FALSE;
+	if (buf)
+		free(buf);
+	return FALSE;
 }
 
 static void ngcs_cmd_stop(ngcs_request * req)
 {
-    int i = 0;
-    ngcs_watch *watch;
-    active_db_h *serv = NULL;
-    char *svcname = NULL;
-
-    if (req->argc != 2 || req->argv[1].type != NGCS_TYPE_STRING ||
-	req->argv[1].len <= 0)
-    {
-	F_("Bad call to ngcs command 'stop'\n");
-	ngcs_send_response(req, NGCS_TYPE_STRING, 8, "BAD_CALL");
-	return;
-    }
+	int i = 0;
+	ngcs_watch *watch;
+	active_db_h *serv = NULL;
+	char *svcname = NULL;
+
+	if (req->argc != 2 || req->argv[1].type != NGCS_TYPE_STRING ||
+		req->argv[1].len <= 0)
+	{
+		F_("Bad call to ngcs command 'stop'\n");
+		ngcs_send_response(req, NGCS_TYPE_STRING, 8, "BAD_CALL");
+		return;
+	}
 
-    svcname = req->argv[1].d.s;
+	svcname = req->argv[1].d.s;
 
-    serv = initng_active_db_find_in_name(svcname);
-    if (!serv)
-    {
-	ngcs_send_response(req, NGCS_TYPE_STRING, 9, "NOT_FOUND");
-	return;
-    }
+	serv = initng_active_db_find_in_name(svcname);
+	if (!serv)
+	{
+		ngcs_send_response(req, NGCS_TYPE_STRING, 9, "NOT_FOUND");
+		return;
+	}
 
-    watch = ngcs_add_watch(req->conn, serv->name,
-			   NGCS_WATCH_STATUS | NGCS_WATCH_OUTPUT |
-			   NGCS_CURRENT_STATUS);
-    if (watch)
-	i = watch->chan->id;
-    ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
-    ngcs_watch_initial(watch);
-    initng_handler_stop_service(serv);
-    return;
+	watch = ngcs_add_watch(req->conn, serv->name,
+						   NGCS_WATCH_STATUS | NGCS_WATCH_OUTPUT |
+						   NGCS_CURRENT_STATUS);
+	if (watch)
+		i = watch->chan->id;
+	ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+	ngcs_watch_initial(watch);
+	initng_handler_stop_service(serv);
+	return;
 }
 
 
 static void ngcs_cmd_start(ngcs_request * req)
 {
-    int i = 0;
-    ngcs_watch *watch;
-    active_db_h *serv = NULL;
-    char *svcname = NULL;
-
-    if (req->argc != 2 || req->argv[1].type != NGCS_TYPE_STRING ||
-	req->argv[1].len <= 0)
-    {
-	F_("Bad call to ngcs command 'start'\n");
-	ngcs_send_response(req, NGCS_TYPE_STRING, 8, "BAD_CALL");
-	return;
-    }
+	int i = 0;
+	ngcs_watch *watch;
+	active_db_h *serv = NULL;
+	char *svcname = NULL;
+
+	if (req->argc != 2 || req->argv[1].type != NGCS_TYPE_STRING ||
+		req->argv[1].len <= 0)
+	{
+		F_("Bad call to ngcs command 'start'\n");
+		ngcs_send_response(req, NGCS_TYPE_STRING, 8, "BAD_CALL");
+		return;
+	}
 
-    svcname = req->argv[1].d.s;
+	svcname = req->argv[1].d.s;
+
+	serv = initng_active_db_find_in_name(svcname);
+	if (serv)
+	{
+		watch = ngcs_add_watch(req->conn, serv->name,
+							   NGCS_WATCH_STATUS | NGCS_WATCH_OUTPUT |
+							   NGCS_CURRENT_STATUS);
+		if (watch)
+			i = watch->chan->id;
+		ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+		ngcs_watch_initial(watch);
+		if (!IS_UP(serv))
+			initng_handler_start_service(serv);
+		return;
+	}
+
+	serv = initng_handler_start_new_service_named(svcname);
+	if (!serv)
+	{
+		ngcs_send_response(req, NGCS_TYPE_STRING, 9, "NOT_FOUND");
+		return;
+	}
 
-    serv = initng_active_db_find_in_name(svcname);
-    if (serv)
-    {
 	watch = ngcs_add_watch(req->conn, serv->name,
-			       NGCS_WATCH_STATUS | NGCS_WATCH_OUTPUT |
-			       NGCS_CURRENT_STATUS);
+						   NGCS_WATCH_STATUS | NGCS_WATCH_OUTPUT);
 	if (watch)
-	    i = watch->chan->id;
+		i = watch->chan->id;
 	ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
 	ngcs_watch_initial(watch);
-	if (!IS_UP(serv))
-	    initng_handler_start_service(serv);
 	return;
-    }
-
-    serv = initng_handler_start_new_service_named(svcname);
-    if (!serv)
-    {
-	ngcs_send_response(req, NGCS_TYPE_STRING, 9, "NOT_FOUND");
-	return;
-    }
-
-    watch = ngcs_add_watch(req->conn, serv->name,
-			   NGCS_WATCH_STATUS | NGCS_WATCH_OUTPUT);
-    if (watch)
-	i = watch->chan->id;
-    ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
-    ngcs_watch_initial(watch);
-    return;
 }
 
 ngcs_watch *ngcs_add_watch(ngcs_conn * conn, char *svcname, int flags)
 {
-    assert(conn);
-    ngcs_chan *chan;
-    ngcs_watch *watch;
-
-    watch = i_calloc(1, sizeof(ngcs_watch));
-
-    chan = ngcs_open_channel(conn, NULL, ngcs_free_watch);
-    if (!chan)
-    {
-	F_("ngcs_open_channel failed!\n");
-	free(watch);
-	return 0;
-    }
-    if (svcname)
-	watch->name = i_strdup(svcname);
-    else
-	watch->name = NULL;
-    watch->flags = flags;
-    watch->chan = chan;
-    watch->list.prev = 0;
-    watch->list.next = 0;
-    list_add(&watch->list, &watches.list);
-    chan->user_data = watch;
-    return watch;
+	assert(conn);
+	ngcs_chan *chan;
+	ngcs_watch *watch;
+
+	watch = i_calloc(1, sizeof(ngcs_watch));
+
+	chan = ngcs_open_channel(conn, NULL, ngcs_free_watch);
+	if (!chan)
+	{
+		F_("ngcs_open_channel failed!\n");
+		free(watch);
+		return 0;
+	}
+	if (svcname)
+		watch->name = i_strdup(svcname);
+	else
+		watch->name = NULL;
+	watch->flags = flags;
+	watch->chan = chan;
+	watch->list.prev = 0;
+	watch->list.next = 0;
+	list_add(&watch->list, &watches.list);
+	chan->user_data = watch;
+	return watch;
 }
 
 static void ngcs_cmd_swatch(ngcs_request * req)
 {
-    int i = 0;
-    ngcs_genwatch *watch;
-    ngcs_chan *chan;
-
-    watch = i_calloc(1, sizeof(ngcs_genwatch));
-
-    chan = ngcs_open_channel(req->conn, NULL, &ngcs_free_genwatch);
-    if (!chan)
-    {
-	F_("ngcs_open_channel failed!\n");
-	free(watch);
-	return;
-    }
-    watch->chan = chan;
-    watch->list.prev = 0;
-    watch->list.next = 0;
-    list_add(&watch->list, &swatches.list);
+	int i = 0;
+	ngcs_genwatch *watch;
+	ngcs_chan *chan;
 
-    i = chan->id;
-    ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+	watch = i_calloc(1, sizeof(ngcs_genwatch));
+
+	chan = ngcs_open_channel(req->conn, NULL, &ngcs_free_genwatch);
+	if (!chan)
+	{
+		F_("ngcs_open_channel failed!\n");
+		free(watch);
+		return;
+	}
+	watch->chan = chan;
+	watch->list.prev = 0;
+	watch->list.next = 0;
+	list_add(&watch->list, &swatches.list);
+
+	i = chan->id;
+	ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
 }
 
 static void ngcs_cmd_ewatch(ngcs_request * req)
 {
-    int i = 0;
-    ngcs_genwatch *watch;
-    ngcs_chan *chan;
-
-    watch = i_calloc(1, sizeof(ngcs_genwatch));
-
-    chan = ngcs_open_channel(req->conn, NULL, &ngcs_free_genwatch);
-    if (!chan)
-    {
-	F_("ngcs_open_channel failed!\n");
-	free(watch);
-	return;
-    }
-    watch->chan = chan;
-    watch->list.prev = 0;
-    watch->list.next = 0;
-    list_add(&watch->list, &ewatches.list);
+	int i = 0;
+	ngcs_genwatch *watch;
+	ngcs_chan *chan;
+
+	watch = i_calloc(1, sizeof(ngcs_genwatch));
+
+	chan = ngcs_open_channel(req->conn, NULL, &ngcs_free_genwatch);
+	if (!chan)
+	{
+		F_("ngcs_open_channel failed!\n");
+		free(watch);
+		return;
+	}
+	watch->chan = chan;
+	watch->list.prev = 0;
+	watch->list.next = 0;
+	list_add(&watch->list, &ewatches.list);
 
-    i = chan->id;
-    ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+	i = chan->id;
+	ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
 }
 
 static void ngcs_cmd_watch(ngcs_request * req)
 {
-    int i = 0;
-    ngcs_watch *watch;
-    char *name;
-
-    if (req->argc != 3 || req->argv[1].type != NGCS_TYPE_INT ||
-	(req->argv[2].type != NGCS_TYPE_STRING && req->argv[2].type !=
-	 NGCS_TYPE_NULL))
-    {
-	F_("Bad watch command\n");
+	int i = 0;
+	ngcs_watch *watch;
+	char *name;
+
+	if (req->argc != 3 || req->argv[1].type != NGCS_TYPE_INT ||
+		(req->argv[2].type != NGCS_TYPE_STRING && req->argv[2].type !=
+		 NGCS_TYPE_NULL))
+	{
+		F_("Bad watch command\n");
+		ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+		return;
+	}
+	if (req->argv[2].type == NGCS_TYPE_NULL || req->argv[2].d.s[0] == '\0')
+		name = NULL;
+	else
+		name = req->argv[2].d.s;
+
+	watch = ngcs_add_watch(req->conn, name, req->argv[1].d.i);
+	if (watch)
+		i = watch->chan->id;
 	ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
-	return;
-    }
-    if (req->argv[2].type == NGCS_TYPE_NULL || req->argv[2].d.s[0] == '\0')
-	name = NULL;
-    else
-	name = req->argv[2].d.s;
-
-    watch = ngcs_add_watch(req->conn, name, req->argv[1].d.i);
-    if (watch)
-	i = watch->chan->id;
-    ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
-    ngcs_watch_initial(watch);
+	ngcs_watch_initial(watch);
 }
 
 static void ngcs_free_watch(ngcs_chan * chan)
 {
-    ngcs_watch *watch = chan->user_data;
+	ngcs_watch *watch = chan->user_data;
 
-    if (!watch)
-	return;
-    list_del(&watch->list);
-    if (watch->name)
-	free(watch->name);
-    free(watch);
-    chan->user_data = 0;
+	if (!watch)
+		return;
+	list_del(&watch->list);
+	if (watch->name)
+		free(watch->name);
+	free(watch);
+	chan->user_data = 0;
 }
 
 static void ngcs_free_genwatch(ngcs_chan * chan)
 {
-    ngcs_genwatch *watch = chan->user_data;
+	ngcs_genwatch *watch = chan->user_data;
 
-    if (!watch)
-	return;
-    list_del(&watch->list);
-    free(watch);
-    chan->user_data = 0;
+	if (!watch)
+		return;
+	list_del(&watch->list);
+	free(watch);
+	chan->user_data = 0;
 }
 
 void register_ngcs_cmds(void)
 {
-    ngcs_reg_cmd(&ngcs_start_cmd);
-    ngcs_reg_cmd(&ngcs_stop_cmd);
-    ngcs_reg_cmd(&ngcs_watch_cmd);
-    ngcs_reg_cmd(&ngcs_swatch_cmd);
-    ngcs_reg_cmd(&ngcs_ewatch_cmd);
-    ngcs_reg_cmd(&ngcs_hot_reload_cmd);
-    ngcs_reg_cmd(&ngcs_hot_reload_cmd_short);
-    ngcs_reg_cmd(&ngcs_hot_reload_cmd_long);
-    ngcs_reg_cmd(&ngcs_zap_cmd);
-    initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &service_status_watch);
-    initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &service_output_watch);
-    initng_plugin_hook_add(&g.SWATCHERS, 50, &system_state_watch);
-    initng_plugin_hook_add(&g.ERR_MSG, 50, &error_watch);
-    INIT_LIST_HEAD(&watches.list);
-    INIT_LIST_HEAD(&swatches.list);
-    INIT_LIST_HEAD(&ewatches.list);
+	ngcs_reg_cmd(&ngcs_start_cmd);
+	ngcs_reg_cmd(&ngcs_stop_cmd);
+	ngcs_reg_cmd(&ngcs_watch_cmd);
+	ngcs_reg_cmd(&ngcs_swatch_cmd);
+	ngcs_reg_cmd(&ngcs_ewatch_cmd);
+	ngcs_reg_cmd(&ngcs_hot_reload_cmd);
+	ngcs_reg_cmd(&ngcs_hot_reload_cmd_short);
+	ngcs_reg_cmd(&ngcs_hot_reload_cmd_long);
+	ngcs_reg_cmd(&ngcs_zap_cmd);
+	initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &service_status_watch);
+	initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &service_output_watch);
+	initng_plugin_hook_add(&g.SWATCHERS, 50, &system_state_watch);
+	initng_plugin_hook_add(&g.ERR_MSG, 50, &error_watch);
+	INIT_LIST_HEAD(&watches.list);
+	INIT_LIST_HEAD(&swatches.list);
+	INIT_LIST_HEAD(&ewatches.list);
 }
 
 void unregister_ngcs_cmds(void)
 {
-    initng_plugin_hook_del(&g.ASTATUS_CHANGE, &service_status_watch);
-    initng_plugin_hook_del(&g.PIPEWATCHERS, &service_output_watch);
-    ngcs_unreg_cmd(&ngcs_start_cmd);
-    ngcs_unreg_cmd(&ngcs_stop_cmd);
-    ngcs_unreg_cmd(&ngcs_watch_cmd);
-    ngcs_unreg_cmd(&ngcs_swatch_cmd);
-    ngcs_unreg_cmd(&ngcs_ewatch_cmd);
-    ngcs_unreg_cmd(&ngcs_hot_reload_cmd);
-    ngcs_unreg_cmd(&ngcs_hot_reload_cmd_short);
-    ngcs_unreg_cmd(&ngcs_hot_reload_cmd_long);
-    ngcs_unreg_cmd(&ngcs_zap_cmd);
-    /* FIXME - *really* need to free watches */
+	initng_plugin_hook_del(&g.ASTATUS_CHANGE, &service_status_watch);
+	initng_plugin_hook_del(&g.PIPEWATCHERS, &service_output_watch);
+	ngcs_unreg_cmd(&ngcs_start_cmd);
+	ngcs_unreg_cmd(&ngcs_stop_cmd);
+	ngcs_unreg_cmd(&ngcs_watch_cmd);
+	ngcs_unreg_cmd(&ngcs_swatch_cmd);
+	ngcs_unreg_cmd(&ngcs_ewatch_cmd);
+	ngcs_unreg_cmd(&ngcs_hot_reload_cmd);
+	ngcs_unreg_cmd(&ngcs_hot_reload_cmd_short);
+	ngcs_unreg_cmd(&ngcs_hot_reload_cmd_long);
+	ngcs_unreg_cmd(&ngcs_zap_cmd);
+	/* FIXME - *really* need to free watches */
 }
 
 static void ngcs_cmd_zap(ngcs_request * req)
 {
-    int i = 0;
-    active_db_h *apt = NULL;
+	int i = 0;
+	active_db_h *apt = NULL;
 
-    if (req->argc != 2 || req->argv[1].type != NGCS_TYPE_STRING)
-    {
-	ngcs_send_response(req, NGCS_TYPE_NULL, 0, NULL);
-	return;
-    }
+	if (req->argc != 2 || req->argv[1].type != NGCS_TYPE_STRING)
+	{
+		ngcs_send_response(req, NGCS_TYPE_NULL, 0, NULL);
+		return;
+	}
 
-    if (!(apt = initng_active_db_find_in_name(req->argv[1].d.s)))
-    {
-	ngcs_send_response(req, NGCS_TYPE_STRING, 9, "NOT_FOUND");
-	return;
-    }
+	if (!(apt = initng_active_db_find_in_name(req->argv[1].d.s)))
+	{
+		ngcs_send_response(req, NGCS_TYPE_STRING, 9, "NOT_FOUND");
+		return;
+	}
 
-    initng_active_db_del(apt);
-    initng_active_db_free(apt);
+	initng_active_db_del(apt);
+	initng_active_db_free(apt);
 
-    /* also flush file cache */
-    /* cmd_reload(arg); - FIXME */
+	/* also flush file cache */
+	/* cmd_reload(arg); - FIXME */
 
-    /* return happily */
-    ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
+	/* return happily */
+	ngcs_send_response(req, NGCS_TYPE_INT, sizeof(int), (char *) &i);
 }
 
 /* ngc2 special-cases this in the client. I prefer to do it here
@@ -607,33 +607,33 @@
    between the ngcs API and the standard s_command one... */
 static void ngcs_cmd_hot_reload(ngcs_request * req)
 {
-    int i = 1;
+	int i = 1;
+
+	int retval;
+	char *new_argv[4];
 
-    int retval;
-    char *new_argv[4];
+	retval = initng_plugin_callers_dump_active_db();
 
-    retval = initng_plugin_callers_dump_active_db();
+	if (retval == TRUE)
+	{
+		ngcs_send_response(req, NGCS_TYPE_BOOL, sizeof(int), (char *) &i);
+		D_("exec()ing initng\n");
+		new_argv[0] = i_strdup("/sbin/initng");
+		new_argv[1] = i_strdup("--hot_reload");
+		new_argv[2] = NULL;
 
-    if (retval == TRUE)
-    {
-	ngcs_send_response(req, NGCS_TYPE_BOOL, sizeof(int), (char *) &i);
-	D_("exec()ing initng\n");
-	new_argv[0] = i_strdup("/sbin/initng");
-	new_argv[1] = i_strdup("--hot_reload");
-	new_argv[2] = NULL;
-
-	execve("/sbin/initng", new_argv, environ);
-	F_("Failed to reload initng!\n");
-    }
-    else if (retval == FALSE)
-    {
-	F_("No plugin was willing to dump state\n");
-	ngcs_send_response(req, NGCS_TYPE_ERROR, 13,
-			   (char *) "NOT_AVAILABLE");
-    }
-    else
-    {
-	F_("dump_state failed!\n");
-	ngcs_send_response(req, NGCS_TYPE_ERROR, 10, (char *) "DUMP_ERROR");
-    }
+		execve("/sbin/initng", new_argv, environ);
+		F_("Failed to reload initng!\n");
+	}
+	else if (retval == FALSE)
+	{
+		F_("No plugin was willing to dump state\n");
+		ngcs_send_response(req, NGCS_TYPE_ERROR, 13,
+						   (char *) "NOT_AVAILABLE");
+	}
+	else
+	{
+		F_("dump_state failed!\n");
+		ngcs_send_response(req, NGCS_TYPE_ERROR, 10, (char *) "DUMP_ERROR");
+	}
 }

Modified: initng/trunk/plugins/ngcs/ngcs_common.c
==============================================================================
--- initng/trunk/plugins/ngcs/ngcs_common.c	(original)
+++ initng/trunk/plugins/ngcs/ngcs_common.c	Wed Apr  5 23:11:19 2006
@@ -26,398 +26,398 @@
 
 int ngcs_sendmsg(int sock, int chan, int type, int len, const char *data)
 {
-    int head[3];
+	int head[3];
 
-    if (len > 0)
-	assert(data);
-    head[0] = chan;
-    head[1] = type;
-    head[2] = len;
-    if (ngcs_sendall(sock, head, 3 * sizeof(int)))
-	return 1;
-    if (len <= 0)
+	if (len > 0)
+		assert(data);
+	head[0] = chan;
+	head[1] = type;
+	head[2] = len;
+	if (ngcs_sendall(sock, head, 3 * sizeof(int)))
+		return 1;
+	if (len <= 0)
+		return 0;
+	if (ngcs_sendall(sock, data, len))
+		return 1;
 	return 0;
-    if (ngcs_sendall(sock, data, len))
-	return 1;
-    return 0;
 }
 
 int ngcs_recvmsg(int sock, int *chan, int *type, int *len, char **data)
 {
-    int head[3];
+	int head[3];
+
+	assert(chan);
+	assert(type);
+	assert(len);
+	assert(data);
 
-    assert(chan);
-    assert(type);
-    assert(len);
-    assert(data);
-
-    if (ngcs_recvall(sock, head, 3 * sizeof(int)))
-	return 1;
-    *chan = head[0];
-    *type = head[1];
-    *len = head[2];
-    if (*len < 0)
-    {
-	*data = NULL;
+	if (ngcs_recvall(sock, head, 3 * sizeof(int)))
+		return 1;
+	*chan = head[0];
+	*type = head[1];
+	*len = head[2];
+	if (*len < 0)
+	{
+		*data = NULL;
+		return 0;
+	}
+	*data = malloc(*len);
+	if (*data == NULL)
+		return 1;
+	if (ngcs_recvall(sock, *data, *len))
+		return 1;
 	return 0;
-    }
-    *data = malloc(*len);
-    if (*data == NULL)
-	return 1;
-    if (ngcs_recvall(sock, *data, *len))
-	return 1;
-    return 0;
 }
 
 int ngcs_pack(ngcs_data * data, int cnt, char *buf)
 {
-    int n;
-    int outcnt = 0;
+	int n;
+	int outcnt = 0;
 
-    for (n = 0; n < cnt; n++)
-    {
-	if (buf)
-	{
-	    *(int *) buf = data[n].type;
-	    buf += sizeof(int);
-	}
-	switch (data[n].type)
+	for (n = 0; n < cnt; n++)
 	{
-	    case NGCS_TYPE_INT:
-	    case NGCS_TYPE_BOOL:
-		outcnt += 3 * sizeof(int);
-		if (buf)
-		{
-		    *(int *) buf = sizeof(int);
-		    buf += sizeof(int);
-		    *(int *) buf = data[n].d.i;
-		    buf += sizeof(int);
-		}
-		break;
-	    case NGCS_TYPE_LONG:
-		outcnt += 2 * sizeof(int) + sizeof(long);
-		if (buf)
-		{
-		    *(int *) buf = sizeof(long);
-		    buf += sizeof(int);
-		    *(int *) buf = data[n].d.l;
-		    buf += sizeof(long);
-		}
-		break;
-	    case NGCS_TYPE_ERROR:
-	    case NGCS_TYPE_STRING:
-		if (data[n].len < 0)
-		    data[n].len = strlen(data[n].d.s);
-		outcnt += 2 * sizeof(int) + data[n].len;
 		if (buf)
 		{
-		    *(int *) buf = data[n].len;
-		    buf += sizeof(int);
-		    if (data[n].len)
-			memcpy(buf, data[n].d.s, data[n].len);
-		    buf += data[n].len;
+			*(int *) buf = data[n].type;
+			buf += sizeof(int);
 		}
-		break;
-	    default:
-		if (data[n].len < 0)
-		    return 1;
-		outcnt += 2 * sizeof(int) + data[n].len;
-		if (buf)
+		switch (data[n].type)
 		{
-		    *(int *) buf = data[n].len;
-		    buf += sizeof(int);
-		    if (data[n].len)
-			memcpy(buf, data[n].d.p, data[n].len);
-		    buf += data[n].len;
+			case NGCS_TYPE_INT:
+			case NGCS_TYPE_BOOL:
+				outcnt += 3 * sizeof(int);
+				if (buf)
+				{
+					*(int *) buf = sizeof(int);
+					buf += sizeof(int);
+					*(int *) buf = data[n].d.i;
+					buf += sizeof(int);
+				}
+				break;
+			case NGCS_TYPE_LONG:
+				outcnt += 2 * sizeof(int) + sizeof(long);
+				if (buf)
+				{
+					*(int *) buf = sizeof(long);
+					buf += sizeof(int);
+					*(int *) buf = data[n].d.l;
+					buf += sizeof(long);
+				}
+				break;
+			case NGCS_TYPE_ERROR:
+			case NGCS_TYPE_STRING:
+				if (data[n].len < 0)
+					data[n].len = strlen(data[n].d.s);
+				outcnt += 2 * sizeof(int) + data[n].len;
+				if (buf)
+				{
+					*(int *) buf = data[n].len;
+					buf += sizeof(int);
+					if (data[n].len)
+						memcpy(buf, data[n].d.s, data[n].len);
+					buf += data[n].len;
+				}
+				break;
+			default:
+				if (data[n].len < 0)
+					return 1;
+				outcnt += 2 * sizeof(int) + data[n].len;
+				if (buf)
+				{
+					*(int *) buf = data[n].len;
+					buf += sizeof(int);
+					if (data[n].len)
+						memcpy(buf, data[n].d.p, data[n].len);
+					buf += data[n].len;
+				}
+				break;
 		}
-		break;
 	}
-    }
-    return outcnt;
+	return outcnt;
 }
 
 
 int ngcs_unpack(const char *data, int len, ngcs_data ** res)
 {
-    const char *d = data;
-    int l = len;
-    int cnt = 0;
-    while (l >= 2 * (int) sizeof(int))
-    {
-	int head[2];
-	memcpy(head, d, 2 * sizeof(int));
-	if (head[1] < 0)
-	    return -1;
-	d += 2 * sizeof(int) + head[1];
-	l -= 2 * sizeof(int) + head[1];
-	cnt++;
-    }
-    d = data;
-    l = len;
-    *res = malloc(cnt * sizeof(ngcs_data));
-    cnt = 0;
-    while (l >= 2 * (int) sizeof(int))
-    {
-	int head[2];
-	memcpy(head, d, 2 * sizeof(int));
-	(*res)[cnt].type = head[0];
-	(*res)[cnt].len = head[1];
-	if (head[1] < 0)
-	{
-	    free(*res);
-	    *res = NULL;
-	    return -1;
-	}
-	d += 2 * sizeof(int);
-	l -= 2 * sizeof(int);
-	if (l < (*res)[cnt].len)
-	{
-	    free(*res);
-	    *res = NULL;
-	    return -1;
-	}
-	switch ((*res)[cnt].type)
-	{
-	    case NGCS_TYPE_INT:
-	    case NGCS_TYPE_BOOL:
-		if ((*res)[cnt].len != sizeof(int))
-		{
-		    free(*res);
-		    *res = NULL;
-		    return -1;
-		}
-		(*res)[cnt].d.i = *(int *) d;
-		break;
-	    case NGCS_TYPE_LONG:
-		if ((*res)[cnt].len != sizeof(long))
+	const char *d = data;
+	int l = len;
+	int cnt = 0;
+	while (l >= 2 * (int) sizeof(int))
+	{
+		int head[2];
+		memcpy(head, d, 2 * sizeof(int));
+		if (head[1] < 0)
+			return -1;
+		d += 2 * sizeof(int) + head[1];
+		l -= 2 * sizeof(int) + head[1];
+		cnt++;
+	}
+	d = data;
+	l = len;
+	*res = malloc(cnt * sizeof(ngcs_data));
+	cnt = 0;
+	while (l >= 2 * (int) sizeof(int))
+	{
+		int head[2];
+		memcpy(head, d, 2 * sizeof(int));
+		(*res)[cnt].type = head[0];
+		(*res)[cnt].len = head[1];
+		if (head[1] < 0)
 		{
-		    free(*res);
-		    *res = NULL;
-		    return -1;
+			free(*res);
+			*res = NULL;
+			return -1;
 		}
-		(*res)[cnt].d.i = *(int *) d;
-		break;
-	    case NGCS_TYPE_ERROR:
-	    case NGCS_TYPE_STRING:
-		(*res)[cnt].d.s = malloc((*res)[cnt].len + 1);
-		if (!(*res)[cnt].d.s)
+		d += 2 * sizeof(int);
+		l -= 2 * sizeof(int);
+		if (l < (*res)[cnt].len)
 		{
-		    free(*res);
-		    *res = NULL;
-		    return -1;
+			free(*res);
+			*res = NULL;
+			return -1;
 		}
-		memcpy((*res)[cnt].d.s, d, (*res)[cnt].len);
-		(*res)[cnt].d.s[(*res)[cnt].len] = 0;
-		break;
-	    default:
-		(*res)[cnt].d.p = malloc((*res)[cnt].len);
-		if (!(*res)[cnt].d.p)
+		switch ((*res)[cnt].type)
 		{
-		    free(*res);
-		    *res = NULL;
-		    return -1;
+			case NGCS_TYPE_INT:
+			case NGCS_TYPE_BOOL:
+				if ((*res)[cnt].len != sizeof(int))
+				{
+					free(*res);
+					*res = NULL;
+					return -1;
+				}
+				(*res)[cnt].d.i = *(int *) d;
+				break;
+			case NGCS_TYPE_LONG:
+				if ((*res)[cnt].len != sizeof(long))
+				{
+					free(*res);
+					*res = NULL;
+					return -1;
+				}
+				(*res)[cnt].d.i = *(int *) d;
+				break;
+			case NGCS_TYPE_ERROR:
+			case NGCS_TYPE_STRING:
+				(*res)[cnt].d.s = malloc((*res)[cnt].len + 1);
+				if (!(*res)[cnt].d.s)
+				{
+					free(*res);
+					*res = NULL;
+					return -1;
+				}
+				memcpy((*res)[cnt].d.s, d, (*res)[cnt].len);
+				(*res)[cnt].d.s[(*res)[cnt].len] = 0;
+				break;
+			default:
+				(*res)[cnt].d.p = malloc((*res)[cnt].len);
+				if (!(*res)[cnt].d.p)
+				{
+					free(*res);
+					*res = NULL;
+					return -1;
+				}
+				memcpy((*res)[cnt].d.p, d, (*res)[cnt].len);
+				break;
 		}
-		memcpy((*res)[cnt].d.p, d, (*res)[cnt].len);
-		break;
+		d += (*res)[cnt].len;
+		l -= (*res)[cnt].len;
+		cnt++;
 	}
-	d += (*res)[cnt].len;
-	l -= (*res)[cnt].len;
-	cnt++;
-    }
-    return cnt;
+	return cnt;
 }
 
 void ngcs_free_unpack(int len, ngcs_data * res)
 {
-    int n;
+	int n;
 
-    for (n = 0; n < len; n++)
-    {
-	switch (res[n].type)
-	{
-	    case NGCS_TYPE_INT:
-	    case NGCS_TYPE_LONG:
-		break;
-	    case NGCS_TYPE_STRING:
-		if (res[n].d.s)
-		    free(res[n].d.s);
-		break;
-	    default:
-		if (res[n].d.p)
-		    free(res[n].d.p);
-		break;
+	for (n = 0; n < len; n++)
+	{
+		switch (res[n].type)
+		{
+			case NGCS_TYPE_INT:
+			case NGCS_TYPE_LONG:
+				break;
+			case NGCS_TYPE_STRING:
+				if (res[n].d.s)
+					free(res[n].d.s);
+				break;
+			default:
+				if (res[n].d.p)
+					free(res[n].d.p);
+				break;
+		}
 	}
-    }
-    free(res);
+	free(res);
 }
 
 ngcs_conn *ngcs_conn_from_fd(int fd, void *userdata,
-			     void (*close_hook) (ngcs_conn * conn))
+							 void (*close_hook) (ngcs_conn * conn))
 {
-    ngcs_conn *conn;
-    struct timeval tv;
+	ngcs_conn *conn;
+	struct timeval tv;
+
+	conn = malloc(sizeof(ngcs_conn));
+	if (conn == NULL)
+		return NULL;
+
+	/* FIXME - should set non-blocking and use buffering */
+	tv.tv_sec = 2;
+	tv.tv_usec = 0;
+	if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) ||
+		setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)))
+	{
+		/* FIXME - shoupd print error? */
+		return NULL;
+	}
+
 
-    conn = malloc(sizeof(ngcs_conn));
-    if (conn == NULL)
-	return NULL;
-
-    /* FIXME - should set non-blocking and use buffering */
-    tv.tv_sec = 2;
-    tv.tv_usec = 0;
-    if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) ||
-	setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv)))
-    {
-	/* FIXME - shoupd print error? */
-	return NULL;
-    }
-
-
-    INIT_LIST_HEAD(&conn->chans.list);
-    conn->fd = fd;
-    conn->userdata = userdata;
-    conn->close_hook = close_hook;
-    return conn;
+	INIT_LIST_HEAD(&conn->chans.list);
+	conn->fd = fd;
+	conn->userdata = userdata;
+	conn->close_hook = close_hook;
+	return conn;
 }
 
 
 ngcs_chan *ngcs_chan_reg(ngcs_conn * conn, int chanid,
-			 void (*gotdata) (ngcs_chan *, int, int,
-					  char *),
-			 void (*chanfree) (ngcs_chan *))
-{
-    ngcs_chan *chan = malloc(sizeof(ngcs_chan));
-
-    if (!chan)
-	return NULL;
-
-    chan->id = chanid;
-    chan->conn = conn;
-    chan->user_data = NULL;
-    chan->gotdata = gotdata;
-    chan->free = chanfree;
-    chan->list.next = 0;
-    chan->list.prev = 0;
-    list_add(&chan->list, &conn->chans.list);
-    return chan;
+						 void (*gotdata) (ngcs_chan *, int, int,
+										  char *),
+						 void (*chanfree) (ngcs_chan *))
+{
+	ngcs_chan *chan = malloc(sizeof(ngcs_chan));
+
+	if (!chan)
+		return NULL;
+
+	chan->id = chanid;
+	chan->conn = conn;
+	chan->user_data = NULL;
+	chan->gotdata = gotdata;
+	chan->free = chanfree;
+	chan->list.next = 0;
+	chan->list.prev = 0;
+	list_add(&chan->list, &conn->chans.list);
+	return chan;
 }
 
 void ngcs_chan_del(ngcs_chan * chan)
 {
-    if (chan->conn->fd >= 0 && chan->free)
-	chan->free(chan);
-    list_del(&chan->list);
-    free(chan);
+	if (chan->conn->fd >= 0 && chan->free)
+		chan->free(chan);
+	list_del(&chan->list);
+	free(chan);
 }
 
 
 void ngcs_conn_data_ready(ngcs_conn * conn)
 {
-    int chanid, len, type;
-    char *data;
-    ngcs_chan *chan;
-
-    /* Get message */
-    if (ngcs_recvmsg(conn->fd, &chanid, &type, &len, &data))
-    {
-	ngcs_conn_close(conn);
-	return;
-    }
+	int chanid, len, type;
+	char *data;
+	ngcs_chan *chan;
 
-    /* Dispatch to handler for this channel */
-    while_ngcs_chans(chan, conn) if (chan->id == chanid)
-    {
-	if (chan->gotdata)
-	    chan->gotdata(chan, type, len, data);
+	/* Get message */
+	if (ngcs_recvmsg(conn->fd, &chanid, &type, &len, &data))
+	{
+		ngcs_conn_close(conn);
+		return;
+	}
+
+	/* Dispatch to handler for this channel */
+	while_ngcs_chans(chan, conn) if (chan->id == chanid)
+	{
+		if (chan->gotdata)
+			chan->gotdata(chan, type, len, data);
+		free(data);
+		return;
+	}
+
+	/* Unknown channel - close it */
+	if (ngcs_sendmsg(conn->fd, chanid, NGCS_TYPE_NULL, -1, NULL))
+		ngcs_conn_close(conn);
 	free(data);
 	return;
-    }
-
-    /* Unknown channel - close it */
-    if (ngcs_sendmsg(conn->fd, chanid, NGCS_TYPE_NULL, -1, NULL))
-	ngcs_conn_close(conn);
-    free(data);
-    return;
 }
 
 void ngcs_conn_close(ngcs_conn * conn)
 {
-    ngcs_chan *chan, *tmp;
+	ngcs_chan *chan, *tmp;
 
-    if (conn->fd < 0)
-	return;
-    close(conn->fd);
-    conn->fd = -1;
-    while_ngcs_chans_safe(chan, tmp, conn)
-    {
-	if (chan->free)
-	    chan->free(chan);
-    }
-    if (conn->close_hook)
-	conn->close_hook(conn);
+	if (conn->fd < 0)
+		return;
+	close(conn->fd);
+	conn->fd = -1;
+	while_ngcs_chans_safe(chan, tmp, conn)
+	{
+		if (chan->free)
+			chan->free(chan);
+	}
+	if (conn->close_hook)
+		conn->close_hook(conn);
 }
 
 void ngcs_conn_free(ngcs_conn * conn)
 {
-    ngcs_chan *chan, *tmp;
+	ngcs_chan *chan, *tmp;
 
-    ngcs_conn_close(conn);
-    while_ngcs_chans_safe(chan, tmp, conn)
-    {
-	list_del(&chan->list);
-	free(chan);
-    }
-    free(conn);
-    /* TODO */
+	ngcs_conn_close(conn);
+	while_ngcs_chans_safe(chan, tmp, conn)
+	{
+		list_del(&chan->list);
+		free(chan);
+	}
+	free(conn);
+	/* TODO */
 }
 
 int ngcs_sendall(int sock, const void *buf, int len)
 {
-    int ret;
+	int ret;
 
-    while (len > 0)
-    {
-	ret = send(sock, buf, len, 0);
-	if (ret <= 0)
-	{
-	    return 1;
-	}
-	else
+	while (len > 0)
 	{
-	    buf += ret;
-	    len -= ret;
+		ret = send(sock, buf, len, 0);
+		if (ret <= 0)
+		{
+			return 1;
+		}
+		else
+		{
+			buf += ret;
+			len -= ret;
+		}
 	}
-    }
-    return 0;
+	return 0;
 }
 
 int ngcs_recvall(int sock, void *buf, int len)
 {
-    int ret;
+	int ret;
 
-    while (len > 0)
-    {
-	ret = recv(sock, buf, len, 0);
-	if (ret <= 0)
-	{
-	    return 1;
-	}
-	else
+	while (len > 0)
 	{
-	    buf += ret;
-	    len -= ret;
+		ret = recv(sock, buf, len, 0);
+		if (ret <= 0)
+		{
+			return 1;
+		}
+		else
+		{
+			buf += ret;
+			len -= ret;
+		}
 	}
-    }
-    return 0;
+	return 0;
 }
 
 int ngcs_chan_send(ngcs_chan * chan, int type, int len, const char *data)
 {
-    if (chan->conn->fd < 0)
-	return 1;
-    if (ngcs_sendmsg(chan->conn->fd, chan->id, type, len, data))
-    {
-	ngcs_conn_close(chan->conn);
-	return 1;
-    }
-    return 0;
+	if (chan->conn->fd < 0)
+		return 1;
+	if (ngcs_sendmsg(chan->conn->fd, chan->id, type, len, data))
+	{
+		ngcs_conn_close(chan->conn);
+		return 1;
+	}
+	return 0;
 }

Modified: initng/trunk/plugins/ngcs/ngcs_common.h
==============================================================================
--- initng/trunk/plugins/ngcs/ngcs_common.h	(original)
+++ initng/trunk/plugins/ngcs/ngcs_common.h	Wed Apr  5 23:11:19 2006
@@ -81,65 +81,65 @@
 /*! \brief Data associated with a channel on a connection */
 struct ngcs_chan_s
 {
-    /*! \brief The channel ID (uniquely identifies this channel
-       from the channels on this connection) */
-    int id;
-
-    /*! \brief The connection the channel is on */
-    ngcs_conn *conn;
-
-    /*! \brief Can be used by your handler code to store state relating to this
-       channel */
-    void *user_data;
-
-    /*! \brief A function called when data is received on the channel */
-    void (*gotdata) (ngcs_chan *, int /* type */ , int /* len */ ,
-		     char * /* data */ );
-
-    /*! \brief A function called when the channel is closed (possibly at 
-       connection termination) */
-    void (*free) (ngcs_chan *);
-    struct list_head list;
+	/*! \brief The channel ID (uniquely identifies this channel
+	   from the channels on this connection) */
+	int id;
+
+	/*! \brief The connection the channel is on */
+	ngcs_conn *conn;
+
+	/*! \brief Can be used by your handler code to store state relating to this
+	   channel */
+	void *user_data;
+
+	/*! \brief A function called when data is received on the channel */
+	void (*gotdata) (ngcs_chan *, int /* type */ , int /* len */ ,
+					 char * /* data */ );
+
+	/*! \brief A function called when the channel is closed (possibly at 
+	   connection termination) */
+	void (*free) (ngcs_chan *);
+	struct list_head list;
 };
 
 
 
 typedef struct ngcs_data_s
 {
-    /*! \brief The data type of this datum (see NGCS_TYPE constants) */
-    int type;
+	/*! \brief The data type of this datum (see NGCS_TYPE constants) */
+	int type;
 
-    /*! \brief The length in bytes of the data */
-    int len;
-    union
-    {
-	/*! \brief The data as an integer, if type == NGCS_TYPE_INT */
-	int i;
-
-	/*! \brief The data as a long, if type == NGCS_TYPE_LONG */
-	long l;
-
-	/*! \brief The data as a null-terminated string, if type == NGCS_TYPE_STRING */
-	char *s;
-
-	/*! \brief The raw data, in cases not specifically covered */
-	void *p;
-    } d;
+	/*! \brief The length in bytes of the data */
+	int len;
+	union
+	{
+		/*! \brief The data as an integer, if type == NGCS_TYPE_INT */
+		int i;
+
+		/*! \brief The data as a long, if type == NGCS_TYPE_LONG */
+		long l;
+
+		/*! \brief The data as a null-terminated string, if type == NGCS_TYPE_STRING */
+		char *s;
+
+		/*! \brief The raw data, in cases not specifically covered */
+		void *p;
+	} d;
 } ngcs_data;
 
 struct ngcs_conn_s
 {
-    /*! \brief The file descriptor associated with the connection */
-    int fd;
+	/*! \brief The file descriptor associated with the connection */
+	int fd;
 
-    /*! \brief A list of all channels registered on this connection */
-    ngcs_chan chans;
+	/*! \brief A list of all channels registered on this connection */
+	ngcs_chan chans;
 
-    /*! \brief Can be used by your code to store state relating to this connection */
-    void *userdata;
+	/*! \brief Can be used by your code to store state relating to this connection */
+	void *userdata;
 
-    /*! \brief A function called when the connection is closed */
-    void (*close_hook) (ngcs_conn * conn);
+	/*! \brief A function called when the connection is closed */
+	void (*close_hook) (ngcs_conn * conn);
 };
 
 int ngcs_sendall(int sock, const void *buf, int len);
@@ -253,7 +253,7 @@
  *        careful what you put in it.
  */
 ngcs_conn *ngcs_conn_from_fd(int fd, void *userdata,
-			     void (*close_hook) (ngcs_conn * conn));
+							 void (*close_hook) (ngcs_conn * conn));
 
 /*! \brief Registers a channel handler on the specified connection
  * 
@@ -271,9 +271,9 @@
  *         free it), or NULL on failure
  */
 ngcs_chan *ngcs_chan_reg(ngcs_conn * conn, int chanid,
-			 void (*gotdata) (ngcs_chan *, int, int,
-					  char *),
-			 void (*chanfree) (ngcs_chan *));
+						 void (*gotdata) (ngcs_chan *, int, int,
+										  char *),
+						 void (*chanfree) (ngcs_chan *));
 
 /*! \brief Unregisters the specified channel handler
  *

Modified: initng/trunk/plugins/nge/initng_nge.c
==============================================================================
--- initng/trunk/plugins/nge/initng_nge.c	(original)
+++ initng/trunk/plugins/nge/initng_nge.c	Wed Apr  5 23:11:19 2006
@@ -75,9 +75,9 @@
 static int astatus_change(active_db_h * service);
 static void system_state_change(e_is state);
 static int system_pipe_watchers(active_db_h * service, process_h * process,
-				char *output);
+								char *output);
 static int print_error(e_mt mt, const char *file, const char *func, int line,
-		       const char *format, va_list arg);
+					   const char *format, va_list arg);
 
 /* todo, when last lissener closed, del hooks to save cpu cykles */
 
@@ -85,471 +85,471 @@
 
 static void close_all_lisseners(void)
 {
-    int i;
+	int i;
 
-    for (i = 0; i < MAX_LISSENERS; i++)
-    {
-	if (lisseners[i] > 0)
+	for (i = 0; i < MAX_LISSENERS; i++)
 	{
-	    send(lisseners[i], "</disconnect>\n", sizeof(char) * 16, 0);
-
-	    close(lisseners[i]);
-	    lisseners[i] = -1;
+		if (lisseners[i] > 0)
+		{
+			send(lisseners[i], "</disconnect>\n", sizeof(char) * 16, 0);
+
+			close(lisseners[i]);
+			lisseners[i] = -1;
+		}
 	}
-    }
 }
 
 static void close_initziator_socket(void)
 {
-    /* Check if we need to remove hooks */
-    if (fd_event_acceptor.fds < 0)
-	return;
+	/* Check if we need to remove hooks */
+	if (fd_event_acceptor.fds < 0)
+		return;
 
-    /* only remove if hook is added */
-    if (is_active)
-    {
-	/*
-	 * UnRegister that hooks, that we forwards events from.
-	 */
-	initng_plugin_hook_del(&g.ASTATUS_CHANGE, &astatus_change);
-	initng_plugin_hook_del(&g.SWATCHERS, &system_state_change);
-	initng_plugin_hook_del(&g.PIPEWATCHERS, &system_pipe_watchers);
-	initng_plugin_hook_del(&g.ERR_MSG, &print_error);
-
-	is_active = FALSE;
-    }
-
-    /* close socket and set to 0 */
-    close(fd_event_acceptor.fds);
-    fd_event_acceptor.fds = -1;
+	/* only remove if hook is added */
+	if (is_active)
+	{
+		/*
+		 * UnRegister that hooks, that we forwards events from.
+		 */
+		initng_plugin_hook_del(&g.ASTATUS_CHANGE, &astatus_change);
+		initng_plugin_hook_del(&g.SWATCHERS, &system_state_change);
+		initng_plugin_hook_del(&g.PIPEWATCHERS, &system_pipe_watchers);
+		initng_plugin_hook_del(&g.ERR_MSG, &print_error);
+
+		is_active = FALSE;
+	}
 
-    /* remove tha hook too */
-    initng_plugin_hook_del(&g.FDWATCHERS, &fd_event_acceptor);
+	/* close socket and set to 0 */
+	close(fd_event_acceptor.fds);
+	fd_event_acceptor.fds = -1;
+
+	/* remove tha hook too */
+	initng_plugin_hook_del(&g.FDWATCHERS, &fd_event_acceptor);
 }
 
 /* send to all lisseners */
 void send_to_all(const void *buf, size_t len)
 {
-    D_("send_to_all(%s)\n", (char *) buf);
-    int i;
+	D_("send_to_all(%s)\n", (char *) buf);
+	int i;
 
-    /* walk all lissiners */
-    for (i = 0; i < MAX_LISSENERS; i++)
-    {
-	/* if its not set */
-	if (lisseners[i] < 1)
-	    continue;
-
-	D_("Sending to lisseners[%i] fd %i : %s\n", i, lisseners[i],
-	   (char *) buf);
-	/* if not succed to send */
-	if (send(lisseners[i], buf, len, 0) < (signed) len)
-	{
-	    D_("Fd %i must have been closed.\n", lisseners[i]);
-	    /* close it */
-	    close(lisseners[i]);
-	    lisseners[i] = -1;
+	/* walk all lissiners */
+	for (i = 0; i < MAX_LISSENERS; i++)
+	{
+		/* if its not set */
+		if (lisseners[i] < 1)
+			continue;
+
+		D_("Sending to lisseners[%i] fd %i : %s\n", i, lisseners[i],
+		   (char *) buf);
+		/* if not succed to send */
+		if (send(lisseners[i], buf, len, 0) < (signed) len)
+		{
+			D_("Fd %i must have been closed.\n", lisseners[i]);
+			/* close it */
+			close(lisseners[i]);
+			lisseners[i] = -1;
+		}
 	}
-    }
 
 }
 
 /* called by fd hook, when data is no socket */
 void event_acceptor(f_module_h * from, e_fdw what)
 {
-    /* Temporary variables for sending data */
-    char *string = NULL;
-    int len;
-
-    /* the fd the new lisseners will get */
-    int lis = 0;
-
-    /* make a dumb check */
-    if (from != &fd_event_acceptor)
-	return;
-
-    /* skipp all set lisseners, so we dont owerwrite them */
-    while (lisseners[lis] > 0 && lis != MAX_LISSENERS)
-	lis++;
-    if (lis == MAX_LISSENERS)
-    {
-	F_("Maximum no of lisseners reached.\n");
-	return;
-    }
-
-    D_("Adding new lissener lissensers[%i]\n", lis);
-    if (is_active == FALSE)
-    {
-	/*
-	 * Register that hooks, that we forwards events from.
-	 */
-	initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &astatus_change);
-	initng_plugin_hook_add(&g.SWATCHERS, 50, &system_state_change);
-	initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &system_pipe_watchers);
-	initng_plugin_hook_add(&g.ERR_MSG, 50, &print_error);
-	is_active = TRUE;
-    }
-    /* create a new socket, for reading */
-    if ((lisseners[lis] = accept(fd_event_acceptor.fds, NULL, NULL)) < 1)
-    {
-	F_("Failed to accept lissener!\n");
-	return;
-    }
-
-    D_("opening lissener no #%i.\n", lis);
-
-    /* send header */
-    {
-	send(lisseners[lis], "<? xml version=\"1.0\" ?/>\n",
-	     sizeof(char) * 25, 0);
-    }
-
-    /* send protocol info */
-    {
-	string = i_calloc(70 + strlen(INITNG_VERSION), sizeof(char));
-
-	/* Make a string ready for sending */
-	len = sprintf(string,
-		      "<connect protocol_version=\"%i\", initng_version=\"%s\"/>\n",
-		      NGE_VERSION, INITNG_VERSION);
-
-	/* send the init string to this socket */
-	send(lisseners[lis], string, sizeof(char) * len, 0);
-
-	/* free the initial string */
-	free(string);
-	string = NULL;
-    }
-
-    /* send system initiating state */
-    {
-	string = i_calloc(70, sizeof(char));
-	len = sprintf(string,
-		      "<event type=\"initial_system_state\" system_state=\"%i\" />\n",
-		      g.sys_state);
+	/* Temporary variables for sending data */
+	char *string = NULL;
+	int len;
+
+	/* the fd the new lisseners will get */
+	int lis = 0;
+
+	/* make a dumb check */
+	if (from != &fd_event_acceptor)
+		return;
+
+	/* skipp all set lisseners, so we dont owerwrite them */
+	while (lisseners[lis] > 0 && lis != MAX_LISSENERS)
+		lis++;
+	if (lis == MAX_LISSENERS)
+	{
+		F_("Maximum no of lisseners reached.\n");
+		return;
+	}
 
-	/* send the init string to this socket */
-	send(lisseners[lis], string, sizeof(char) * len, 0);
+	D_("Adding new lissener lissensers[%i]\n", lis);
+	if (is_active == FALSE)
+	{
+		/*
+		 * Register that hooks, that we forwards events from.
+		 */
+		initng_plugin_hook_add(&g.ASTATUS_CHANGE, 50, &astatus_change);
+		initng_plugin_hook_add(&g.SWATCHERS, 50, &system_state_change);
+		initng_plugin_hook_add(&g.PIPEWATCHERS, 50, &system_pipe_watchers);
+		initng_plugin_hook_add(&g.ERR_MSG, 50, &print_error);
+		is_active = TRUE;
+	}
+	/* create a new socket, for reading */
+	if ((lisseners[lis] = accept(fd_event_acceptor.fds, NULL, NULL)) < 1)
+	{
+		F_("Failed to accept lissener!\n");
+		return;
+	}
 
-	/* free the initial string */
-	free(string);
-	string = NULL;
-    }
+	D_("opening lissener no #%i.\n", lis);
 
-    /* send all current services states */
-    {
-	active_db_h *service = NULL;
+	/* send header */
+	{
+		send(lisseners[lis], "<? xml version=\"1.0\" ?/>\n",
+			 sizeof(char) * 25, 0);
+	}
 
-	while_active_db(service)
+	/* send protocol info */
 	{
-	    string = i_realloc(string, (120 + strlen(service->name) +
-					strlen(service->current_state->
-					       state_name)) * sizeof(char));
+		string = i_calloc(70 + strlen(INITNG_VERSION), sizeof(char));
 
-	    len = sprintf(string,
-			  "<event type=\"initial_service_state\" service=\"%s\" is=\"%i\" state=\"%s\" />\n",
-			  service->name, service->current_state->is,
-			  service->current_state->state_name);
+		/* Make a string ready for sending */
+		len = sprintf(string,
+					  "<connect protocol_version=\"%i\", initng_version=\"%s\"/>\n",
+					  NGE_VERSION, INITNG_VERSION);
+
+		/* send the init string to this socket */
+		send(lisseners[lis], string, sizeof(char) * len, 0);
+
+		/* free the initial string */
+		free(string);
+		string = NULL;
+	}
 
-	    /* send the init string to this socket */
-	    send(lisseners[lis], string, sizeof(char) * len, 0);
+	/* send system initiating state */
+	{
+		string = i_calloc(70, sizeof(char));
+		len = sprintf(string,
+					  "<event type=\"initial_system_state\" system_state=\"%i\" />\n",
+					  g.sys_state);
+
+		/* send the init string to this socket */
+		send(lisseners[lis], string, sizeof(char) * len, 0);
+
+		/* free the initial string */
+		free(string);
+		string = NULL;
 	}
 
-	if (string)
+	/* send all current services states */
 	{
-	    /* free the initial string */
-	    free(string);
-	    string = NULL;
+		active_db_h *service = NULL;
+
+		while_active_db(service)
+		{
+			string = i_realloc(string, (120 + strlen(service->name) +
+										strlen(service->current_state->
+											   state_name)) * sizeof(char));
+
+			len = sprintf(string,
+						  "<event type=\"initial_service_state\" service=\"%s\" is=\"%i\" state=\"%s\" />\n",
+						  service->name, service->current_state->is,
+						  service->current_state->state_name);
+
+			/* send the init string to this socket */
+			send(lisseners[lis], string, sizeof(char) * len, 0);
+		}
+
+		if (string)
+		{
+			/* free the initial string */
+			free(string);
+			string = NULL;
+		}
 	}
-    }
 }
 
 
 /* This will try to open a new socket, clients can iniziate to */
 static int open_initziator_socket(void)
 {
-    /*    int flags; */
-    struct sockaddr_un serv_sockname;
+	/*    int flags; */
+	struct sockaddr_un serv_sockname;
 
-    /* Close the iniztiator */
-    close_initziator_socket();
+	/* Close the iniztiator */
+	close_initziator_socket();
 
-    /* Make NGE_PREFIX (/dev/initng) if it doesn't exist (try either way) */
-    if (mkdir(NGE_PREFIX, S_IRUSR | S_IWUSR | S_IXUSR) == -1
-	&& errno != EEXIST)
-    {
-	if (errno != EROFS)
-	    F_("Could not create " NGE_PREFIX
-	       " : %s, may be / fs not mounted read-write yet?, will retry until I succeed.\n",
-	       strerror(errno));
-	return (FALSE);
-    }
+	/* Make NGE_PREFIX (/dev/initng) if it doesn't exist (try either way) */
+	if (mkdir(NGE_PREFIX, S_IRUSR | S_IWUSR | S_IXUSR) == -1
+		&& errno != EEXIST)
+	{
+		if (errno != EROFS)
+			F_("Could not create " NGE_PREFIX
+			   " : %s, may be / fs not mounted read-write yet?, will retry until I succeed.\n",
+			   strerror(errno));
+		return (FALSE);
+	}
 
-    /* chmod root path for root use only */
-    if (chmod(NGE_PREFIX, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
-    {
-	/* path doesn't exist, we don't have /dev yet. */
-	if (errno == ENOENT || errno == EROFS)
-	    return (FALSE);
-
-	F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
-	   NGE_PREFIX);
-    }
-
-    /* Create the socket. */
-    fd_event_acceptor.fds = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (fd_event_acceptor.fds < 1)
-    {
-	F_("Failed to init socket (%s)\n", strerror(errno));
-	fd_event_acceptor.fds = -1;
-	return (FALSE);
-    }
+	/* chmod root path for root use only */
+	if (chmod(NGE_PREFIX, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
+	{
+		/* path doesn't exist, we don't have /dev yet. */
+		if (errno == ENOENT || errno == EROFS)
+			return (FALSE);
 
-    /* Bind a name to the socket. */
-    serv_sockname.sun_family = AF_UNIX;
+		F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
+		   NGE_PREFIX);
+	}
 
-    /* get the socket_filename, set in module_init() */
-    strcpy(serv_sockname.sun_path, socket_filename);
+	/* Create the socket. */
+	fd_event_acceptor.fds = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (fd_event_acceptor.fds < 1)
+	{
+		F_("Failed to init socket (%s)\n", strerror(errno));
+		fd_event_acceptor.fds = -1;
+		return (FALSE);
+	}
 
-    /* Remove old socket file if any */
-    unlink(serv_sockname.sun_path);
-
-    /* Try to bind */
-    if (bind
-	(fd_event_acceptor.fds, (struct sockaddr *) &serv_sockname,
-	 (strlen(serv_sockname.sun_path) +
-	  sizeof(serv_sockname.sun_family))) < 0)
-    {
-	F_("Error binding to socket (errno: %d str: '%s')\n", errno,
-	   strerror(errno));
-	close_initziator_socket();
+	/* Bind a name to the socket. */
+	serv_sockname.sun_family = AF_UNIX;
+
+	/* get the socket_filename, set in module_init() */
+	strcpy(serv_sockname.sun_path, socket_filename);
+
+	/* Remove old socket file if any */
 	unlink(serv_sockname.sun_path);
-	return (FALSE);
-    }
 
-    /* chmod socket for root only use */
-    if (chmod(serv_sockname.sun_path, S_IRUSR | S_IWUSR) == -1)
-    {
-	F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
-	   serv_sockname.sun_path);
-	close_initziator_socket();
-	return (FALSE);
-    }
+	/* Try to bind */
+	if (bind
+		(fd_event_acceptor.fds, (struct sockaddr *) &serv_sockname,
+		 (strlen(serv_sockname.sun_path) +
+		  sizeof(serv_sockname.sun_family))) < 0)
+	{
+		F_("Error binding to socket (errno: %d str: '%s')\n", errno,
+		   strerror(errno));
+		close_initziator_socket();
+		unlink(serv_sockname.sun_path);
+		return (FALSE);
+	}
 
-    /* store sock_stat for checking if we need to recreate socket later */
-    stat(serv_sockname.sun_path, &sock_stat);
+	/* chmod socket for root only use */
+	if (chmod(serv_sockname.sun_path, S_IRUSR | S_IWUSR) == -1)
+	{
+		F_("CRITICAL, failed to chmod %s, THIS IS A SECURITY PROBLEM.\n",
+		   serv_sockname.sun_path);
+		close_initziator_socket();
+		return (FALSE);
+	}
 
-    /* Listen to socket */
-    if (listen(fd_event_acceptor.fds, 5))
-    {
-	F_("Error on listen (errno: %d str: '%s')\n", errno, strerror(errno));
-	close_initziator_socket();
-	unlink(serv_sockname.sun_path);
-	return (FALSE);
-    }
+	/* store sock_stat for checking if we need to recreate socket later */
+	stat(serv_sockname.sun_path, &sock_stat);
+
+	/* Listen to socket */
+	if (listen(fd_event_acceptor.fds, 5))
+	{
+		F_("Error on listen (errno: %d str: '%s')\n", errno, strerror(errno));
+		close_initziator_socket();
+		unlink(serv_sockname.sun_path);
+		return (FALSE);
+	}
 
-    /*
-     * Add an hook, so when fd_event_acceptor.fds have data,
-     * fd_event_acceptor.call (event_acceptor()) is called.
-     */
-    initng_plugin_hook_add(&g.FDWATCHERS, 30, &fd_event_acceptor);
+	/*
+	 * Add an hook, so when fd_event_acceptor.fds have data,
+	 * fd_event_acceptor.call (event_acceptor()) is called.
+	 */
+	initng_plugin_hook_add(&g.FDWATCHERS, 30, &fd_event_acceptor);
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 /* this will check socket, and reopen on failure */
 static void check_socket(int signal)
 {
-    struct stat st;
+	struct stat st;
 
-    if (signal != SIGHUP)
-	return;
+	if (signal != SIGHUP)
+		return;
 
 #define PING "<event type=\"ping\"/>\n"
-    send_to_all(PING, sizeof(char) * strlen(PING));
-    D_("Checking socket\n");
+	send_to_all(PING, sizeof(char) * strlen(PING));
+	D_("Checking socket\n");
 
-    /* Check if socket needs reopening */
-    if (fd_event_acceptor.fds <= 0)
-    {
-	D_("fd_event_acceptor.fds not set, opening new socket.\n");
-	open_initziator_socket();
-	return;
-    }
+	/* Check if socket needs reopening */
+	if (fd_event_acceptor.fds <= 0)
+	{
+		D_("fd_event_acceptor.fds not set, opening new socket.\n");
+		open_initziator_socket();
+		return;
+	}
 
-    /* stat the socket, reopen on failure */
-    memset(&st, 0, sizeof(st));
-    if (stat(socket_filename, &st) < 0)
-    {
-	W_("Stat failed! Opening new socket.\n");
-	open_initziator_socket();
-	return;
-    }
+	/* stat the socket, reopen on failure */
+	memset(&st, 0, sizeof(st));
+	if (stat(socket_filename, &st) < 0)
+	{
+		W_("Stat failed! Opening new socket.\n");
+		open_initziator_socket();
+		return;
+	}
 
-    /* compare socket file, with the one that we know, reopen on failure */
-    if (st.st_dev != sock_stat.st_dev || st.st_ino != sock_stat.st_ino
-	|| st.st_mtime != sock_stat.st_mtime)
-    {
-	F_("Invalid socket found, reopening\n");
-	open_initziator_socket();
-	return;
-    }
+	/* compare socket file, with the one that we know, reopen on failure */
+	if (st.st_dev != sock_stat.st_dev || st.st_ino != sock_stat.st_ino
+		|| st.st_mtime != sock_stat.st_mtime)
+	{
+		F_("Invalid socket found, reopening\n");
+		open_initziator_socket();
+		return;
+	}
 
-    D_("Socket ok.\n");
-    return;
+	D_("Socket ok.\n");
+	return;
 }
 
 static int astatus_change(active_db_h * service)
 {
-    char *buffert = NULL;
-    int len;
+	char *buffert = NULL;
+	int len;
 
-    buffert = calloc(120 + strlen(service->name) +
-		     strlen(service->current_state->state_name),
-		     sizeof(char));
-
-    len = sprintf(buffert,
-		  "<event type=\"service_state_change\" service=\"%s\" is=\"%i\" state=\"%s\" />\n",
-		  service->name, service->current_state->is,
-		  service->current_state->state_name);
-
-    /*printf("astatus_change: %s %i %s\n",
-       service->name, service->current_state->is,
-       service->current_state->state_name); */
+	buffert = calloc(120 + strlen(service->name) +
+					 strlen(service->current_state->state_name),
+					 sizeof(char));
+
+	len = sprintf(buffert,
+				  "<event type=\"service_state_change\" service=\"%s\" is=\"%i\" state=\"%s\" />\n",
+				  service->name, service->current_state->is,
+				  service->current_state->state_name);
+
+	/*printf("astatus_change: %s %i %s\n",
+	   service->name, service->current_state->is,
+	   service->current_state->state_name); */
 
-    if (len > 1)
-	send_to_all(buffert, sizeof(char) * len);
+	if (len > 1)
+		send_to_all(buffert, sizeof(char) * len);
 
-    free(buffert);
-    return (TRUE);
+	free(buffert);
+	return (TRUE);
 }
 
 static void system_state_change(e_is state)
 {
-    char buffert[75];
-    int len;
+	char buffert[75];
+	int len;
 
 
-    len = sprintf(buffert,
-		  "<event type=\"system_state_change\" system_state=\"%i\" />\n",
-		  state);
+	len = sprintf(buffert,
+				  "<event type=\"system_state_change\" system_state=\"%i\" />\n",
+				  state);
 
-    if (len > 1)
-	send_to_all(buffert, sizeof(char) * len);
+	if (len > 1)
+		send_to_all(buffert, sizeof(char) * len);
 }
 
 static int system_pipe_watchers(active_db_h * service, process_h * process,
-				char *output)
+								char *output)
 {
-    char *buffert = NULL;
-    int len;
-    buffert = calloc(100 + strlen(service->name) + strlen(process->pt->name) +
-		     strlen(output), sizeof(char));
-
-    len = sprintf(buffert,
-		  "<event type=\"service_output\" service=\"%s\" process=\"%s\">%s</event>\n",
-		  service->name, process->pt->name, output);
+	char *buffert = NULL;
+	int len;
+	buffert = calloc(100 + strlen(service->name) + strlen(process->pt->name) +
+					 strlen(output), sizeof(char));
 
-    if (len > 0)
-	send_to_all(buffert, sizeof(char) * len);
+	len = sprintf(buffert,
+				  "<event type=\"service_output\" service=\"%s\" process=\"%s\">%s</event>\n",
+				  service->name, process->pt->name, output);
 
-    /* free buffert */
-    free(buffert);
+	if (len > 0)
+		send_to_all(buffert, sizeof(char) * len);
 
-    /* return, output not handled */
-    return (FALSE);
+	/* free buffert */
+	free(buffert);
+
+	/* return, output not handled */
+	return (FALSE);
 }
 
 static int print_error(e_mt mt, const char *file, const char *func,
-		       int line, const char *format, va_list arg)
+					   int line, const char *format, va_list arg)
 {
-    char *buffert = NULL;
+	char *buffert = NULL;
 
-    char *msg;
-    int len, size;
+	char *msg;
+	int len, size;
 
-    size = 256;
-    msg = i_calloc(1, size);
-    len = vsnprintf(msg, size, format, arg);
-    while (len < 0 || len >= size)
-    {
-	/* Some glibc versions apparently return -1 if buffer too small.
-	   Oh, and the argument counts the null char, but the return 
-	   value doesn't, apparently. (See man page for gory details.) */
-	size = (len < 0 ? size * 2 : len + 1);
-	free(msg);
+	size = 256;
 	msg = i_calloc(1, size);
-	len = vsnprintf(msg, 256, format, arg);
-    }
+	len = vsnprintf(msg, size, format, arg);
+	while (len < 0 || len >= size)
+	{
+		/* Some glibc versions apparently return -1 if buffer too small.
+		   Oh, and the argument counts the null char, but the return 
+		   value doesn't, apparently. (See man page for gory details.) */
+		size = (len < 0 ? size * 2 : len + 1);
+		free(msg);
+		msg = i_calloc(1, size);
+		len = vsnprintf(msg, 256, format, arg);
+	}
 
-    buffert = calloc(100 + len + strlen(file) + strlen(func), sizeof(char));
+	buffert = calloc(100 + len + strlen(file) + strlen(func), sizeof(char));
 
-    len = sprintf(buffert,
-		  "<event type=\"err_msg\" mt=\"%i\" file=\"%s\" func=\"%s\" line=\"%i\">%s</event>\n",
-		  mt, file, func, line, msg);
+	len = sprintf(buffert,
+				  "<event type=\"err_msg\" mt=\"%i\" file=\"%s\" func=\"%s\" line=\"%i\">%s</event>\n",
+				  mt, file, func, line, msg);
 
-    len = vsnprintf(msg, 1000, format, arg);
+	len = vsnprintf(msg, 1000, format, arg);
 
-    buffert = calloc(100 + len + strlen(file) + strlen(func), sizeof(char));
+	buffert = calloc(100 + len + strlen(file) + strlen(func), sizeof(char));
 
-    len = sprintf(buffert,
-		  "<event type=\"err_msg\" mt=\"%i\" file=\"%s\" func=\"%s\" line=\"%i\">%s</event>\n",
-		  mt, file, func, line, msg);
+	len = sprintf(buffert,
+				  "<event type=\"err_msg\" mt=\"%i\" file=\"%s\" func=\"%s\" line=\"%i\">%s</event>\n",
+				  mt, file, func, line, msg);
 
-    send_to_all(buffert, sizeof(char) * len);
+	send_to_all(buffert, sizeof(char) * len);
 
-    /* free buffert */
-    free(buffert);
+	/* free buffert */
+	free(buffert);
 
 
-    return (FALSE);
+	return (FALSE);
 }
 
 
 int module_init(int api_version)
 {
-    int i;
+	int i;
 
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    /* clear lisseners struct */
-    for (i = 0; i < MAX_LISSENERS; i++)
-	lisseners[i] = -1;
-
-    /* zero globals */
-    fd_event_acceptor.fds = -1;
-    memset(&sock_stat, 0, sizeof(sock_stat));
-
-    /*
-     * Decide witch path to socket to use.
-     * set socket_filename to right path
-     */
-    {
-	/* decide which socket to use */
-	if (g.i_am_init)
-	    socket_filename = NGE_REAL;
-	else
-	    socket_filename = NGE_TEST;
-	D_("Socket is: %s\n", socket_filename);
-    }
-
-    /*
-     * Giving initng a SIGHUP, will make initng check that all sockets are open,
-     * and reopen the sockets that have been deleted.
-     */
-    initng_plugin_hook_add(&g.SIGNAL, 50, &check_socket);
+	/* clear lisseners struct */
+	for (i = 0; i < MAX_LISSENERS; i++)
+		lisseners[i] = -1;
 
-    /* do the first socket directly */
-    open_initziator_socket();
+	/* zero globals */
+	fd_event_acceptor.fds = -1;
+	memset(&sock_stat, 0, sizeof(sock_stat));
+
+	/*
+	 * Decide witch path to socket to use.
+	 * set socket_filename to right path
+	 */
+	{
+		/* decide which socket to use */
+		if (g.i_am_init)
+			socket_filename = NGE_REAL;
+		else
+			socket_filename = NGE_TEST;
+		D_("Socket is: %s\n", socket_filename);
+	}
+
+	/*
+	 * Giving initng a SIGHUP, will make initng check that all sockets are open,
+	 * and reopen the sockets that have been deleted.
+	 */
+	initng_plugin_hook_add(&g.SIGNAL, 50, &check_socket);
+
+	/* do the first socket directly */
+	open_initziator_socket();
 
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
@@ -558,13 +558,13 @@
 void module_unload(void)
 {
 
-    /* close initziator socket */
-    close_initziator_socket();
+	/* close initziator socket */
+	close_initziator_socket();
 
-    /* dissconect all lisseners */
-    close_all_lisseners();
+	/* dissconect all lisseners */
+	close_all_lisseners();
 
-    /* remove g.SIGNAL check hook */
-    initng_plugin_hook_del(&g.SIGNAL, &check_socket);
+	/* remove g.SIGNAL check hook */
+	initng_plugin_hook_del(&g.SIGNAL, &check_socket);
 
 }

Modified: initng/trunk/plugins/nge/libngeclient.c
==============================================================================
--- initng/trunk/plugins/nge/libngeclient.c	(original)
+++ initng/trunk/plugins/nge/libngeclient.c	Wed Apr  5 23:11:19 2006
@@ -50,89 +50,89 @@
 /* open socket, specified path */
 int ngeclient_open_socket(nge_event * event, const char *path)
 {
-    int len;
-    struct sockaddr_un sockname;
+	int len;
+	struct sockaddr_un sockname;
 
-    assert(event);
-    assert(path);
+	assert(event);
+	assert(path);
 
-    /* check that socket is not open already */
-    if (event->sock > 1)
-    {
-	ngeclient_error = "Socket already open.";
-	/*fprintf(stderr, "Socket already open.\n"); */
-	return (-1);
-    }
-
-    event->sock = -1;
-    event->read_buffer = NULL;
-    event->read_buffer_len = 0;
-
-    /* Create the socket. */
-    event->sock = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (event->sock < 0)
-    {
-	ngeclient_error = "Failed to init socket.";
-	/*fprintf(stderr, "Failed to init socket."); */
-	return (-1);
-    }
-
-    /* Bind a name to the socket. */
-    sockname.sun_family = AF_UNIX;
-    strcpy(sockname.sun_path, path);
-    len = strlen(path) + sizeof(sockname.sun_family);
-
-    if (connect(event->sock, (struct sockaddr *) &sockname, len) < 0)
-    {
-	close(event->sock);
-	ngeclient_error = "Error connecting to socket";
-	/*fprintf(stderr, "Error connecting to socket\n"); */
-	return (-1);
-    }
-
-
-    /* Put it not to block, waiting for more data on rscv */
-    {
-	int cur = fcntl(event->sock, F_GETFL, 0);
+	/* check that socket is not open already */
+	if (event->sock > 1)
+	{
+		ngeclient_error = "Socket already open.";
+		/*fprintf(stderr, "Socket already open.\n"); */
+		return (-1);
+	}
+
+	event->sock = -1;
+	event->read_buffer = NULL;
+	event->read_buffer_len = 0;
+
+	/* Create the socket. */
+	event->sock = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (event->sock < 0)
+	{
+		ngeclient_error = "Failed to init socket.";
+		/*fprintf(stderr, "Failed to init socket."); */
+		return (-1);
+	}
+
+	/* Bind a name to the socket. */
+	sockname.sun_family = AF_UNIX;
+	strcpy(sockname.sun_path, path);
+	len = strlen(path) + sizeof(sockname.sun_family);
+
+	if (connect(event->sock, (struct sockaddr *) &sockname, len) < 0)
+	{
+		close(event->sock);
+		ngeclient_error = "Error connecting to socket";
+		/*fprintf(stderr, "Error connecting to socket\n"); */
+		return (-1);
+	}
+
+
+	/* Put it not to block, waiting for more data on rscv */
+	{
+		int cur = fcntl(event->sock, F_GETFL, 0);
 
-	fcntl(event->sock, F_SETFL, cur | O_NONBLOCK);
-    }
+		fcntl(event->sock, F_SETFL, cur | O_NONBLOCK);
+	}
 
-    /* return happily */
-    return (event->sock);
+	/* return happily */
+	return (event->sock);
 }
 
 /* This will try to free the buffer completely */
 void ngeclient_free_buffer(nge_event * event)
 {
-    if (event->read_buffer)
-    {
-	free(event->read_buffer);
-	event->read_buffer = NULL;
-	event->read_buffer_len = 0;
-    }
+	if (event->read_buffer)
+	{
+		free(event->read_buffer);
+		event->read_buffer = NULL;
+		event->read_buffer_len = 0;
+	}
 }
 
 /* close pipes */
 void ngeclient_close_socket(nge_event * event)
 {
-    assert(event);
+	assert(event);
 
-    /* if socket is open, close it */
-    if (event->sock > 0)
-    {
-	close(event->sock);
-    }
-
-    /* set socket marked closed */
-    event->sock = -1;
-
-    /* free read_buffer */
-    if (event->read_buffer)
-    {
-	free(event->read_buffer);
-	event->read_buffer = NULL;
-    }
+	/* if socket is open, close it */
+	if (event->sock > 0)
+	{
+		close(event->sock);
+	}
+
+	/* set socket marked closed */
+	event->sock = -1;
+
+	/* free read_buffer */
+	if (event->read_buffer)
+	{
+		free(event->read_buffer);
+		event->read_buffer = NULL;
+	}
 }
 
 
@@ -145,41 +145,41 @@
  */
 int ngeclient_read_and_fill_buffer(nge_event * event)
 {
-    int totally_got = 0;
-    int chars_recv = 1;		/* must be one so the while loop will be run */
+	int totally_got = 0;
+	int chars_recv = 1;			/* must be one so the while loop will be run */
 
-    assert(event);
-    assert(event->sock > 0);
-
-    /* while we got data from recv, (or the initziating time ) */
-    while (chars_recv > 0)
-    {
-
-	/*printf("reallocating to %i\n", event->read_buffer_len + 101 ); */
-	/* Allocate more room for input */
-	event->read_buffer = realloc(event->read_buffer,
-				     (event->read_buffer_len +
-				      101) * sizeof(char));
+	assert(event);
+	assert(event->sock > 0);
 
-	/* Make it null terminated, specially if event->read_buffer is created from NULL */
-	event->read_buffer[event->read_buffer_len] = '\0';
+	/* while we got data from recv, (or the initziating time ) */
+	while (chars_recv > 0)
+	{
 
-	/* get 100 chars */
-	chars_recv = recv(event->sock,
-			  &event->read_buffer[event->read_buffer_len], 100,
-			  0);
-
-	/* null the end */
-	if (chars_recv > 0)
-	{
-	    event->read_buffer_len += chars_recv;
-	    event->read_buffer[event->read_buffer_len] = '\0';
-	    totally_got += chars_recv;
+		/*printf("reallocating to %i\n", event->read_buffer_len + 101 ); */
+		/* Allocate more room for input */
+		event->read_buffer = realloc(event->read_buffer,
+									 (event->read_buffer_len +
+									  101) * sizeof(char));
+
+		/* Make it null terminated, specially if event->read_buffer is created from NULL */
+		event->read_buffer[event->read_buffer_len] = '\0';
+
+		/* get 100 chars */
+		chars_recv = recv(event->sock,
+						  &event->read_buffer[event->read_buffer_len], 100,
+						  0);
+
+		/* null the end */
+		if (chars_recv > 0)
+		{
+			event->read_buffer_len += chars_recv;
+			event->read_buffer[event->read_buffer_len] = '\0';
+			totally_got += chars_recv;
+		}
 	}
-    }
 
-    /* return chars got */
-    return (totally_got);
+	/* return chars got */
+	return (totally_got);
 }
 
 /*
@@ -189,25 +189,25 @@
  */
 int ngeclient_poll_for_input(nge_event * event, int seconds)
 {
-    int ret_poll;
-    struct pollfd fds[1];
+	int ret_poll;
+	struct pollfd fds[1];
 
-    assert(event);
+	assert(event);
 
-    /* fille in the poll */
-    fds[0].fd = event->sock;
-    fds[0].events = POLLIN;
+	/* fille in the poll */
+	fds[0].fd = event->sock;
+	fds[0].events = POLLIN;
 
-    /* now wait for data to apeare */
-    ret_poll = poll(fds, 1, seconds);
+	/* now wait for data to apeare */
+	ret_poll = poll(fds, 1, seconds);
 
-    /* if it was any data */
-    if (ret_poll > 0)
-	/* go fetch it */
-	return (ngeclient_read_and_fill_buffer(event));
+	/* if it was any data */
+	if (ret_poll > 0)
+		/* go fetch it */
+		return (ngeclient_read_and_fill_buffer(event));
 
-    /* return the 0 or -1 poll generates */
-    return (ret_poll);
+	/* return the 0 or -1 poll generates */
+	return (ret_poll);
 }
 
 /*
@@ -216,30 +216,30 @@
  */
 void ngeclient_cut_buffert(nge_event * event, int chars)
 {
-    assert(event);
+	assert(event);
+
+	/* dont cut any then */
+	if (chars == 0 || !event->read_buffer || event->read_buffer_len < 1)
+		return;
+
+	/* make sure we are not trying to cut more then we have */
+	if (chars > event->read_buffer_len)
+		chars = event->read_buffer_len;
 
-    /* dont cut any then */
-    if (chars == 0 || !event->read_buffer || event->read_buffer_len < 1)
-	return;
-
-    /* make sure we are not trying to cut more then we have */
-    if (chars > event->read_buffer_len)
-	chars = event->read_buffer_len;
-
-    /* get length of buffer that is left, after chars is cut */
-    event->read_buffer_len -= chars;
-
-    /* move the content in front, to the beginning */
-    memmove(event->read_buffer, &event->read_buffer[chars],
-	    event->read_buffer_len * sizeof(char));
-
-    /* reallocate now, when theres not that mutch data anymore */
-    /*printf("reallocating to %i\n", event->read_buffer_len); */
-    event->read_buffer = realloc(event->read_buffer,
-				 (event->read_buffer_len + 1) * sizeof(char));
+	/* get length of buffer that is left, after chars is cut */
+	event->read_buffer_len -= chars;
 
-    /* make sure its nulled at end */
-    event->read_buffer[event->read_buffer_len] = '\0';
+	/* move the content in front, to the beginning */
+	memmove(event->read_buffer, &event->read_buffer[chars],
+			event->read_buffer_len * sizeof(char));
+
+	/* reallocate now, when theres not that mutch data anymore */
+	/*printf("reallocating to %i\n", event->read_buffer_len); */
+	event->read_buffer = realloc(event->read_buffer,
+								 (event->read_buffer_len + 1) * sizeof(char));
+
+	/* make sure its nulled at end */
+	event->read_buffer[event->read_buffer_len] = '\0';
 }
 
 
@@ -251,60 +251,60 @@
 
 static char *ngeclient_get_content(const char *tag)
 {
-    int len = 0;
-    char *point = (char *) tag;
+	int len = 0;
+	char *point = (char *) tag;
 
-    assert(tag);
+	assert(tag);
 
-    /*
-     * Maks sure we stand here:
-     * "<specialtag>This is some data.</specialtag>"
-     *  |
-     */
-    if (point[0] != '<')
-    {
-	ngeclient_error = "ngeclient_get_content failed. Bad xml.";
-	return (NULL);
-    }
+	/*
+	 * Maks sure we stand here:
+	 * "<specialtag>This is some data.</specialtag>"
+	 *  |
+	 */
+	if (point[0] != '<')
+	{
+		ngeclient_error = "ngeclient_get_content failed. Bad xml.";
+		return (NULL);
+	}
+
+	/* step to the end of tag */
+	while (point[0] && point[0] != '>')
+		point++;
 
-    /* step to the end of tag */
-    while (point[0] && point[0] != '>')
+	/* make sure we got there */
+	if (point[0] != '>')
+	{
+		ngeclient_error = "ngeclient_get_content failed. Bad xml.";
+		return (NULL);
+	}
 	point++;
 
-    /* make sure we got there */
-    if (point[0] != '>')
-    {
-	ngeclient_error = "ngeclient_get_content failed. Bad xml.";
-	return (NULL);
-    }
-    point++;
+	/*
+	 * Maks sure we stand here:
+	 * "<specialtag>This is some data.</specialtag>"
+	 *              |
+	 */
 
-    /*
-     * Maks sure we stand here:
-     * "<specialtag>This is some data.</specialtag>"
-     *              |
-     */
-
-    while (point[len] && point[len] != '<')
-	len++;
-
-    /* make sure we are standing on start on next tag. */
-    if (point[len] != '<')
-    {
-	ngeclient_error = "ngeclient_get_content failed. Bad xml.";
-	return (NULL);
-    }
+	while (point[len] && point[len] != '<')
+		len++;
+
+	/* make sure we are standing on start on next tag. */
+	if (point[len] != '<')
+	{
+		ngeclient_error = "ngeclient_get_content failed. Bad xml.";
+		return (NULL);
+	}
 
-    /*
-     * Maks sure we stand here:
-     * "<specialtag>This is some data.</specialtag>"
-     *              |                 ^
-     */
-    if (len > 0)
-	return (strndup(point, len));
+	/*
+	 * Maks sure we stand here:
+	 * "<specialtag>This is some data.</specialtag>"
+	 *              |                 ^
+	 */
+	if (len > 0)
+		return (strndup(point, len));
 
-    /* else return ZERO */
-    return (NULL);
+	/* else return ZERO */
+	return (NULL);
 }
 
 /*
@@ -315,69 +315,69 @@
  */
 static char *ngeclient_get_option(const char *tag, const char *name)
 {
-    assert(tag);
-    assert(name);
-    char *point = (char *) tag;
-    int name_len = strlen(name);
-
-    /* search for the name in tag */
-    while ((point = strstr(point, name)))
-    {
-	int len = 0;
-
-	/* Standing here:
-	 * "<connect initng_version="initng-123">"
-	 *           |
-	 */
-
-	point += name_len;
-	/* Standing here:
-	 * "<connect initng_version="initng-123">"
-	 *                         |
-	 */
+	assert(tag);
+	assert(name);
+	char *point = (char *) tag;
+	int name_len = strlen(name);
 
-	/* skip spaces */
-	while (point[0] && point[0] == ' ' && point[0] == '\t')
-	    point++;
-
-	/* must be syntax */
-	if (point[0] != '=')
-	    continue;
-	point++;
-
-	/* skip spaces */
-	while (point[0] && point[0] == ' ' && point[0] == '\t')
-	    point++;
-
-	/* Standing here:
-	 * "<connect initng_version="initng-123">"
-	 *                          |
-	 */
-
-	/* must be syntax */
-	if (point[0] != '"')
-	    continue;
-	point++;
-
-	/* Standing here:
-	 * "<connect initng_version="initng-123">"
-	 *                           |
-	 */
-
-	while (point[len] && point[len] != '"')
-	    len++;
+	/* search for the name in tag */
+	while ((point = strstr(point, name)))
+	{
+		int len = 0;
 
-	/* Standing here: | To here: ^
-	 * "<connect initng_version="initng-123">"
-	 *                           |         ^
-	 */
+		/* Standing here:
+		 * "<connect initng_version="initng-123">"
+		 *           |
+		 */
+
+		point += name_len;
+		/* Standing here:
+		 * "<connect initng_version="initng-123">"
+		 *                         |
+		 */
+
+		/* skip spaces */
+		while (point[0] && point[0] == ' ' && point[0] == '\t')
+			point++;
+
+		/* must be syntax */
+		if (point[0] != '=')
+			continue;
+		point++;
+
+		/* skip spaces */
+		while (point[0] && point[0] == ' ' && point[0] == '\t')
+			point++;
+
+		/* Standing here:
+		 * "<connect initng_version="initng-123">"
+		 *                          |
+		 */
+
+		/* must be syntax */
+		if (point[0] != '"')
+			continue;
+		point++;
+
+		/* Standing here:
+		 * "<connect initng_version="initng-123">"
+		 *                           |
+		 */
+
+		while (point[len] && point[len] != '"')
+			len++;
+
+		/* Standing here: | To here: ^
+		 * "<connect initng_version="initng-123">"
+		 *                           |         ^
+		 */
 
-	/* return that string */
-	return (strndup(point, len));
-    }
+		/* return that string */
+		return (strndup(point, len));
+	}
 
-    ngeclient_error = "Could not find option in tag.";
-    return (NULL);
+	ngeclient_error = "Could not find option in tag.";
+	return (NULL);
 }
 
 /*
@@ -386,228 +386,228 @@
  */
 static int ngeclient_get_int(const char *tag, const char *name)
 {
-    int value;
-    char *string;
+	int value;
+	char *string;
 
-    assert(tag);
-    assert(name);
-    string = ngeclient_get_option(tag, name);
-    if (!string)
-	return (-1);
-    value = atoi(string);
-    free(string);
-    return (value);
+	assert(tag);
+	assert(name);
+	string = ngeclient_get_option(tag, name);
+	if (!string)
+		return (-1);
+	value = atoi(string);
+	free(string);
+	return (value);
 }
 
 
 /* called on a <event type="service_state_change"  */
 static void ngeclient_handle_service_state_change(nge_event * event,
-						  char *tag, int chars)
+												  char *tag, int chars)
 {
-    char *service = ngeclient_get_option(tag, "service");
-    e_is is = (e_is) ngeclient_get_int(tag, "is");
-    char *state = ngeclient_get_option(tag, "state");
+	char *service = ngeclient_get_option(tag, "service");
+	e_is is = (e_is) ngeclient_get_int(tag, "is");
+	char *state = ngeclient_get_option(tag, "state");
 
-    if (event->service_state_change)
-	(*event->service_state_change) (event, service, is, state);
+	if (event->service_state_change)
+		(*event->service_state_change) (event, service, is, state);
 
-    /*printf("service_state_change \"%s\", %i chars.\n %s, %i %s \n", tag, chars, service, is , state); */
+	/*printf("service_state_change \"%s\", %i chars.\n %s, %i %s \n", tag, chars, service, is , state); */
 
-    free(service);
-    free(state);
+	free(service);
+	free(state);
 }
 
 /* called on a <event type="system_state_change"  */
 static void ngeclient_handle_system_state_change(nge_event * event, char *tag,
-						 int chars)
+												 int chars)
 {
-    h_sys_state system_state = (h_sys_state) ngeclient_get_int(tag,
-							       "system_state");
+	h_sys_state system_state = (h_sys_state) ngeclient_get_int(tag,
+															   "system_state");
 
-    if (event->system_state_change)
-	(*event->system_state_change) (event, system_state);
+	if (event->system_state_change)
+		(*event->system_state_change) (event, system_state);
 
-    /*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
+	/*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
 
 }
 
 /* called on a <event type="initial_service_state"  */
 static void ngeclient_handle_initial_service_state(nge_event * event,
-						   char *tag, int chars)
+												   char *tag, int chars)
 {
-    char *service = ngeclient_get_option(tag, "service");
-    e_is is = (e_is) ngeclient_get_int(tag, "is");
-    char *state = ngeclient_get_option(tag, "state");
+	char *service = ngeclient_get_option(tag, "service");
+	e_is is = (e_is) ngeclient_get_int(tag, "is");
+	char *state = ngeclient_get_option(tag, "state");
 
-    if (event->initial_service_state)
-	(*event->initial_service_state) (event, service, is, state);
+	if (event->initial_service_state)
+		(*event->initial_service_state) (event, service, is, state);
 
-    /*printf("service_state_change \"%s\", %i chars.\n %s, %i %s \n", tag, chars, service, is , state); */
+	/*printf("service_state_change \"%s\", %i chars.\n %s, %i %s \n", tag, chars, service, is , state); */
 
-    free(service);
-    free(state);
+	free(service);
+	free(state);
 }
 
 /* called on a <event type="initial_system_state"  */
 static void ngeclient_handle_initial_system_state(nge_event * event,
-						  char *tag, int chars)
+												  char *tag, int chars)
 {
-    h_sys_state system_state = (h_sys_state) ngeclient_get_int(tag,
-							       "system_state");
+	h_sys_state system_state = (h_sys_state) ngeclient_get_int(tag,
+															   "system_state");
 
-    if (event->initial_system_state)
-	(*event->initial_system_state) (event, system_state);
+	if (event->initial_system_state)
+		(*event->initial_system_state) (event, system_state);
 
-    /*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
+	/*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
 
 }
 
 /* called on a <event type="service_output"  */
 static void ngeclient_handle_service_output(nge_event * event, char *tag,
-					    int chars)
+											int chars)
 {
-    char *service = ngeclient_get_option(tag, "service");
-    char *process = ngeclient_get_option(tag, "process");
-    char *output = ngeclient_get_content(tag);
+	char *service = ngeclient_get_option(tag, "service");
+	char *process = ngeclient_get_option(tag, "process");
+	char *output = ngeclient_get_content(tag);
 
-    /*printf("Service \"%s\" process \"%s\" outputed:\n%s\n", service, process, output); */
+	/*printf("Service \"%s\" process \"%s\" outputed:\n%s\n", service, process, output); */
 
-    if (event->service_output)
-	(*event->service_output) (event, service, process, output);
+	if (event->service_output)
+		(*event->service_output) (event, service, process, output);
 
-    free(service);
-    free(process);
-    free(output);
+	free(service);
+	free(process);
+	free(output);
 }
 
 /* called on a <event type="err_msg"  */
 static void ngeclient_handle_err_msg(nge_event * event, char *tag, int chars)
 {
-    e_mt mt = (e_mt) ngeclient_get_int(tag, "mt");
-    char *file = ngeclient_get_option(tag, "file");
-    char *func = ngeclient_get_option(tag, "func");
-    int line = ngeclient_get_int(tag, "line");
-    char *message = ngeclient_get_content(tag);
-
-    if (event->err_msg)
-	(*event->err_msg) (event, mt, file, func, line, message);
-
-    /*printf("errmsg mt: %i, file: %s, func: %s line: %i.\n%s\n",
-       mt, file, func, line, message); */
-
-    free(file);
-    free(func);
-    free(message);
+	e_mt mt = (e_mt) ngeclient_get_int(tag, "mt");
+	char *file = ngeclient_get_option(tag, "file");
+	char *func = ngeclient_get_option(tag, "func");
+	int line = ngeclient_get_int(tag, "line");
+	char *message = ngeclient_get_content(tag);
+
+	if (event->err_msg)
+		(*event->err_msg) (event, mt, file, func, line, message);
+
+	/*printf("errmsg mt: %i, file: %s, func: %s line: %i.\n%s\n",
+	   mt, file, func, line, message); */
+
+	free(file);
+	free(func);
+	free(message);
 }
 
 /* called on a <event type="ping"  */
 static void ngeclient_handle_ping(nge_event * event, char *tag, int chars)
 {
-    if (event->ping)
-	(*event->ping) (event);
-    /*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
+	if (event->ping)
+		(*event->ping) (event);
+	/*printf("event-tag \"%s\", %i chars.\n", tag, chars); */
 }
 
 /* called on a <event type= */
 static void ngeclient_handle_event(nge_event * event, char *tag, int chars)
 {
-    char *type = ngeclient_get_option(tag, "type");
+	char *type = ngeclient_get_option(tag, "type");
 
-    if (strcmp(type, "service_state_change") == 0)
-    {
-	ngeclient_handle_service_state_change(event, tag, chars);
-    }
-    else if (strcmp(type, "system_state_change") == 0)
-    {
-	ngeclient_handle_system_state_change(event, tag, chars);
-    }
-    else if (strcmp(type, "service_output") == 0)
-    {
-	ngeclient_handle_service_output(event, tag, chars);
-    }
-    else if (strcmp(type, "err_msg") == 0)
-    {
-	ngeclient_handle_err_msg(event, tag, chars);
-    }
-    if (strcmp(type, "initial_service_state") == 0)
-    {
-	ngeclient_handle_initial_service_state(event, tag, chars);
-    }
-    else if (strcmp(type, "initial_system_state") == 0)
-    {
-	ngeclient_handle_initial_system_state(event, tag, chars);
-    }
-    else if (strcmp(type, "ping") == 0)
-    {
-	ngeclient_handle_ping(event, tag, chars);
-    }
-    else
-    {
-	/*ngeclient_error="Unknown event-tag."; */
-	/*fprintf(stderr, "Unknown event-tag \"%s\"\n", type); */
-    }
+	if (strcmp(type, "service_state_change") == 0)
+	{
+		ngeclient_handle_service_state_change(event, tag, chars);
+	}
+	else if (strcmp(type, "system_state_change") == 0)
+	{
+		ngeclient_handle_system_state_change(event, tag, chars);
+	}
+	else if (strcmp(type, "service_output") == 0)
+	{
+		ngeclient_handle_service_output(event, tag, chars);
+	}
+	else if (strcmp(type, "err_msg") == 0)
+	{
+		ngeclient_handle_err_msg(event, tag, chars);
+	}
+	if (strcmp(type, "initial_service_state") == 0)
+	{
+		ngeclient_handle_initial_service_state(event, tag, chars);
+	}
+	else if (strcmp(type, "initial_system_state") == 0)
+	{
+		ngeclient_handle_initial_system_state(event, tag, chars);
+	}
+	else if (strcmp(type, "ping") == 0)
+	{
+		ngeclient_handle_ping(event, tag, chars);
+	}
+	else
+	{
+		/*ngeclient_error="Unknown event-tag."; */
+		/*fprintf(stderr, "Unknown event-tag \"%s\"\n", type); */
+	}
 
-    free(type);
+	free(type);
 }
 
 /* called on a <connect protocol_version="1" initng_version="initng-123"/> */
 static void ngeclient_handle_connect(nge_event * event, char *tag, int chars)
 {
-    char *initng_version = ngeclient_get_option(tag, "initng_version");
-    int protocol_version = ngeclient_get_int(tag, "protocol_version");
+	char *initng_version = ngeclient_get_option(tag, "initng_version");
+	int protocol_version = ngeclient_get_int(tag, "protocol_version");
 
-    if (protocol_version != NGE_VERSION)
-    {
-	ngeclient_error = "NGE protocol version missmatch!";
-	/*fprintf(stderr, "NGE protocol version missmatch!, (%i, %i) ABORT!\n", protocol_version, NGE_VERSION); */
+	if (protocol_version != NGE_VERSION)
+	{
+		ngeclient_error = "NGE protocol version missmatch!";
+		/*fprintf(stderr, "NGE protocol version missmatch!, (%i, %i) ABORT!\n", protocol_version, NGE_VERSION); */
+		free(initng_version);
+		return;
+	}
+	if (event->connect)
+		(*event->connect) (event, protocol_version, initng_version);
+	/*printf("Connected to initng version: \"%s\" \n", initng_version); */
 	free(initng_version);
-	return;
-    }
-    if (event->connect)
-	(*event->connect) (event, protocol_version, initng_version);
-    /*printf("Connected to initng version: \"%s\" \n", initng_version); */
-    free(initng_version);
 }
 
 /* called when a <disconnect> hook apeares */
 static void ngeclient_handle_disconnect(nge_event * event, char *tag,
-					int chars)
+										int chars)
 {
-    if (event->disconnect)
-	(*event->disconnect) (event);
-    /*printf("disconnect-tag \"%s\", %i chars.\n", tag, chars); */
+	if (event->disconnect)
+		(*event->disconnect) (event);
+	/*printf("disconnect-tag \"%s\", %i chars.\n", tag, chars); */
 }
 
 /* called for every tag nge fetches */
 static void ngeclient_handle_tag(nge_event * event, char *tag, int chars)
 {
-    /* if this is a <? comment > tag */
-    if (tag[1] == '?')
-	return;
-
-    /* if this is a "<event " tag */
-    if (strncmp(&tag[1], "event ", 6) == 0)
-    {
-	ngeclient_handle_event(event, tag, chars);
-	return;
-    }
-
-    /* if this is a "<connect " tag */
-    if (strncmp(&tag[1], "connect ", 8) == 0)
-    {
-	ngeclient_handle_connect(event, tag, chars);
-	return;
-    }
-
-    /* if this is a "<disconnect>" tag */
-    if (strncmp(&tag[1], "disconnect>", 12) == 0)
-    {
-	ngeclient_handle_disconnect(event, tag, chars);
-	return;
-    }
+	/* if this is a <? comment > tag */
+	if (tag[1] == '?')
+		return;
+
+	/* if this is a "<event " tag */
+	if (strncmp(&tag[1], "event ", 6) == 0)
+	{
+		ngeclient_handle_event(event, tag, chars);
+		return;
+	}
 
-    ngeclient_error = "Unknown tag to handle.";
-    /*fprintf(stderr, "Dont know how to handle tag \"%s\", %i chars.\n", tag, chars); */
+	/* if this is a "<connect " tag */
+	if (strncmp(&tag[1], "connect ", 8) == 0)
+	{
+		ngeclient_handle_connect(event, tag, chars);
+		return;
+	}
+
+	/* if this is a "<disconnect>" tag */
+	if (strncmp(&tag[1], "disconnect>", 12) == 0)
+	{
+		ngeclient_handle_disconnect(event, tag, chars);
+		return;
+	}
+
+	ngeclient_error = "Unknown tag to handle.";
+	/*fprintf(stderr, "Dont know how to handle tag \"%s\", %i chars.\n", tag, chars); */
 }
 
 /*
@@ -617,89 +617,89 @@
  */
 void ngeclient_parse_tags(nge_event * event)
 {
-    assert(event);
+	assert(event);
 
 
-    /* make sure there is data */
-    if (event->read_buffer == NULL || event->read_buffer_len < 1)
-	return;
+	/* make sure there is data */
+	if (event->read_buffer == NULL || event->read_buffer_len < 1)
+		return;
 
-    /*printf("read_buffer:\"%s\"\n", event->read_buffer); */
+	/*printf("read_buffer:\"%s\"\n", event->read_buffer); */
 
-    if (event->read_buffer[0] != '<')
-    {
-	ngeclient_error = "Expected an < char, as the first char in an xml protocol.";
-	/*fprintf(stderr, "Bad xml! '%c' len: %i\n", event->read_buffer[0], strlen(event->read_buffer)); */
-	return;
-    }
-
-    /* while there is data to read */
-    while (event->read_buffer && event->read_buffer[0] != '\0'
-	   && event->read_buffer_len > 0)
-    {
-	/* skip newlines */
-	while (event->read_buffer[0] == '\n')
+	if (event->read_buffer[0] != '<')
 	{
-	    /* cut first char from event->read_buffer */
-	    ngeclient_cut_buffert(event, 1);
-	    continue;
+		ngeclient_error = "Expected an < char, as the first char in an xml protocol.";
+		/*fprintf(stderr, "Bad xml! '%c' len: %i\n", event->read_buffer[0], strlen(event->read_buffer)); */
+		return;
 	}
 
-	/* count the lengt of this tag */
-	int chars = 0;
-	int tagend_found = 0;
-
-	while (event->read_buffer[chars])
+	/* while there is data to read */
+	while (event->read_buffer && event->read_buffer[0] != '\0'
+		   && event->read_buffer_len > 0)
 	{
-	    /* if found "/>" This meens tag-out */
-	    if (event->read_buffer[chars] == '/'
-		&& event->read_buffer[chars + 1] == '>')
-	    {
-		chars += 2;
-		tagend_found = 1;
-		break;
-	    }
-
-	    /* if found "</" This is also tag-out */
-	    if (event->read_buffer[chars] == '<'
-		&& event->read_buffer[chars + 1] == '/')
-	    {
-		/*printf("tag_stop: %s\n", &event->read_buffer[chars]); */
-		chars += 2;
-
-		/* skip to the end char of tag */
-		while (event->read_buffer[chars]
-		       && event->read_buffer[chars] != '>')
-		    chars++;
-		if (event->read_buffer[chars] == '>')
-		    chars++;
-		/*printf("tag_stop_after: %s\n", &event->read_buffer[chars]); */
-
-		tagend_found = 1;
-		break;
-	    }
-
-	    /* increase chars of tags counter */
-	    chars++;
-	}
-
-	/* if tagend not found, return to mainloop and fetch more data */
-	if (tagend_found == 0)
-	{
-	    /*printf("No tagend [%i]: \"%s\"\n", chars, event->read_buffer); */
-	    return;
-	}
-
-
-	if (chars > 0 && event->read_buffer[0] == '<')
-	{
-	    char *tmp = strndup(event->read_buffer, chars);
-
-	    ngeclient_handle_tag(event, tmp, chars);
-	    free(tmp);
+		/* skip newlines */
+		while (event->read_buffer[0] == '\n')
+		{
+			/* cut first char from event->read_buffer */
+			ngeclient_cut_buffert(event, 1);
+			continue;
+		}
+
+		/* count the lengt of this tag */
+		int chars = 0;
+		int tagend_found = 0;
+
+		while (event->read_buffer[chars])
+		{
+			/* if found "/>" This meens tag-out */
+			if (event->read_buffer[chars] == '/'
+				&& event->read_buffer[chars + 1] == '>')
+			{
+				chars += 2;
+				tagend_found = 1;
+				break;
+			}
+
+			/* if found "</" This is also tag-out */
+			if (event->read_buffer[chars] == '<'
+				&& event->read_buffer[chars + 1] == '/')
+			{
+				/*printf("tag_stop: %s\n", &event->read_buffer[chars]); */
+				chars += 2;
+
+				/* skip to the end char of tag */
+				while (event->read_buffer[chars]
+					   && event->read_buffer[chars] != '>')
+					chars++;
+				if (event->read_buffer[chars] == '>')
+					chars++;
+				/*printf("tag_stop_after: %s\n", &event->read_buffer[chars]); */
+
+				tagend_found = 1;
+				break;
+			}
+
+			/* increase chars of tags counter */
+			chars++;
+		}
+
+		/* if tagend not found, return to mainloop and fetch more data */
+		if (tagend_found == 0)
+		{
+			/*printf("No tagend [%i]: \"%s\"\n", chars, event->read_buffer); */
+			return;
+		}
+
+
+		if (chars > 0 && event->read_buffer[0] == '<')
+		{
+			char *tmp = strndup(event->read_buffer, chars);
+
+			ngeclient_handle_tag(event, tmp, chars);
+			free(tmp);
+		}
+		ngeclient_cut_buffert(event, chars);
 	}
-	ngeclient_cut_buffert(event, chars);
-    }
 }
 
 
@@ -709,37 +709,37 @@
  */
 void ngeclient_exec(nge_event * event)
 {
-    int got;
+	int got;
 
-    assert(event);
+	assert(event);
 
-    if (event->sock < 1)
-    {
-	ngeclient_error = "Socket not open";
-	/*fprintf(stderr, "Must call open_socket before entering ngeclient loop.\n"); */
-	return;
-    }
-
-    /* poll_for_input will return -1 if socket closes */
-    while (event->sock > 0
-	   && (got = ngeclient_poll_for_input(event, 10000)) >= 0
-	   && event->sock > 0)
-    {
-	/* make sure we got anything */
-	if (got < 1)
-	    continue;
-
-	/* make sure the buffer is pointed */
-	if (event->read_buffer == NULL)
-	    continue;
-
-	/* make sure its not a null chars */
-	if (!event->read_buffer[0])
-	    continue;
+	if (event->sock < 1)
+	{
+		ngeclient_error = "Socket not open";
+		/*fprintf(stderr, "Must call open_socket before entering ngeclient loop.\n"); */
+		return;
+	}
 
-	/* ok, parse tags */
-	ngeclient_parse_tags(event);
+	/* poll_for_input will return -1 if socket closes */
+	while (event->sock > 0
+		   && (got = ngeclient_poll_for_input(event, 10000)) >= 0
+		   && event->sock > 0)
+	{
+		/* make sure we got anything */
+		if (got < 1)
+			continue;
+
+		/* make sure the buffer is pointed */
+		if (event->read_buffer == NULL)
+			continue;
+
+		/* make sure its not a null chars */
+		if (!event->read_buffer[0])
+			continue;
+
+		/* ok, parse tags */
+		ngeclient_parse_tags(event);
 
-	usleep(100);
-    }
+		usleep(100);
+	}
 }

Modified: initng/trunk/plugins/nge/libngeclient.h
==============================================================================
--- initng/trunk/plugins/nge/libngeclient.h	(original)
+++ initng/trunk/plugins/nge/libngeclient.h	Wed Apr  5 23:11:19 2006
@@ -26,28 +26,28 @@
 
 struct s_nge_event
 {
-    /* functions that will be executed on data */
-    void (*service_state_change) (nge_event * event, char *service, e_is is,
-				  char *state_name);
-    void (*system_state_change) (nge_event * event, h_sys_state state);
-    void (*service_output) (nge_event * event, char *service, char *process,
-			    char *output);
-    void (*err_msg) (nge_event * event, e_mt mt, char *file, char *func,
-		     int line, char *message);
-    void (*connect) (nge_event * event, int pver, char *initng_version);
-    void (*disconnect) (nge_event * event);
-    void (*ping) (nge_event * event);
-    void (*initial_service_state) (nge_event * event, char *service, e_is is,
-				   char *state_name);
-    void (*initial_system_state) (nge_event * event, h_sys_state state);
+	/* functions that will be executed on data */
+	void (*service_state_change) (nge_event * event, char *service, e_is is,
+								  char *state_name);
+	void (*system_state_change) (nge_event * event, h_sys_state state);
+	void (*service_output) (nge_event * event, char *service, char *process,
+							char *output);
+	void (*err_msg) (nge_event * event, e_mt mt, char *file, char *func,
+					 int line, char *message);
+	void (*connect) (nge_event * event, int pver, char *initng_version);
+	void (*disconnect) (nge_event * event);
+	void (*ping) (nge_event * event);
+	void (*initial_service_state) (nge_event * event, char *service, e_is is,
+								   char *state_name);
+	void (*initial_system_state) (nge_event * event, h_sys_state state);
 
-    /* standard variables to have */
-    int sock;
-    char *read_buffer;
-    int read_buffer_len;
+	/* standard variables to have */
+	int sock;
+	char *read_buffer;
+	int read_buffer_len;
 
-    /* user data variable, not used by initng itself */
-    void *user_data;
+	/* user data variable, not used by initng itself */
+	void *user_data;
 };
 
 extern const char *ngeclient_error;

Modified: initng/trunk/plugins/nge/nge.c
==============================================================================
--- initng/trunk/plugins/nge/nge.c	(original)
+++ initng/trunk/plugins/nge/nge.c	Wed Apr  5 23:11:19 2006
@@ -48,114 +48,114 @@
 
 static void connected(nge_event * e, int pver, char *initng_version)
 {
-    fprintf(stdout, "Connected to initng %s\n", initng_version);
+	fprintf(stdout, "Connected to initng %s\n", initng_version);
 }
 
 static void disconnected(nge_event * e)
 {
-    fprintf(stdout, "Dissonnected from initng.\n");
+	fprintf(stdout, "Dissonnected from initng.\n");
 }
 
 static void service_change(nge_event * e, char *service, e_is is, char *state)
 {
-    switch (is)
-    {
-	case IS_UP:
-	case IS_DOWN:
-	case IS_FAILED:
-	case IS_STARTING:
-	case IS_STOPPING:
-	case IS_WAITING:
-	default:
-	    fprintf(stdout, "Service \"%s\" have state \"%s\" (%i)\n",
-		    service, state, is);
-	    break;
-    }
+	switch (is)
+	{
+		case IS_UP:
+		case IS_DOWN:
+		case IS_FAILED:
+		case IS_STARTING:
+		case IS_STOPPING:
+		case IS_WAITING:
+		default:
+			fprintf(stdout, "Service \"%s\" have state \"%s\" (%i)\n",
+					service, state, is);
+			break;
+	}
 }
 
 static void ping(nge_event * e)
 {
-    fprintf(stdout, "Got an ping from initng.");
+	fprintf(stdout, "Got an ping from initng.");
 }
 
 static void service_output(nge_event * e, char *service, char *process,
-			   char *output)
+						   char *output)
 {
-    fprintf(stdout, "Service \"%s\" process \"%s\" outputed:\n%s\n", service,
-	    process, output);
+	fprintf(stdout, "Service \"%s\" process \"%s\" outputed:\n%s\n", service,
+			process, output);
 }
 
 static void err_msg(nge_event * e, e_mt mt, char *file, char *func, int line,
-		    char *message)
+					char *message)
 {
-    fprintf(stdout, "Message mt: %i, file: %s, func: %s, line %i.\n%s\n",
-	    mt, file, func, line, message);
+	fprintf(stdout, "Message mt: %i, file: %s, func: %s, line %i.\n%s\n",
+			mt, file, func, line, message);
 }
 
 static void sys_state(nge_event * e, h_sys_state state)
 {
-    switch (state)
-    {
-	case STATE_STARTING:
-	case STATE_UP:
-	case STATE_STOPPING:
-	case STATE_ASE:		    /* All Services Exited */
-	case STATE_SERVICES_LOADED:	    /* This should only be changed by sys_state_services_loaded, that resets sysstate to last service afterwards. */
-	case STATE_EXIT:
-	case STATE_RESTART:
-	case STATE_SULOGIN:
-	case STATE_HALT:
-	case STATE_POWEROFF:
-	case STATE_REBOOT:
-	case STATE_EXECVE:
-	default:
-	    fprintf(stdout, "Initng got a new system state no: %i\n", state);
-	    break;
-    }
+	switch (state)
+	{
+		case STATE_STARTING:
+		case STATE_UP:
+		case STATE_STOPPING:
+		case STATE_ASE:					/* All Services Exited */
+		case STATE_SERVICES_LOADED:		/* This should only be changed by sys_state_services_loaded, that resets sysstate to last service afterwards. */
+		case STATE_EXIT:
+		case STATE_RESTART:
+		case STATE_SULOGIN:
+		case STATE_HALT:
+		case STATE_POWEROFF:
+		case STATE_REBOOT:
+		case STATE_EXECVE:
+		default:
+			fprintf(stdout, "Initng got a new system state no: %i\n", state);
+			break;
+	}
 }
 
 /* THIS IS MAIN */
 int main(int argc, char *argv[])
 {
-    nge_event e;
+	nge_event e;
 
-    /* Always null this, to reset it */
-    memset(&e, 0, sizeof(e));
+	/* Always null this, to reset it */
+	memset(&e, 0, sizeof(e));
 
-    /* set the hooks */
-    e.connect = &connected;
-    e.disconnect = &disconnected;
-    e.service_state_change = &service_change;
-    e.system_state_change = &sys_state;
-    e.initial_service_state = &service_change;
-    e.initial_system_state = &sys_state;
-    e.service_output = &service_output;
-    e.err_msg = &err_msg;
-    e.ping = &ping;
-
-    /* open correct socket */
-    if (strcmp(argv[0], "ngde") == 0)
-	ngeclient_open_socket(&e, NGE_TEST);
-    else
-	ngeclient_open_socket(&e, NGE_REAL);
-
-    /* if open_socket fails, ngeclient_error is set */
-    if (ngeclient_error)
-    {
-	fprintf(stderr, "%s\n", ngeclient_error);
-	exit(1);
-    }
-
-    /* this is the MAIN LOOP for ngeclient */
-    ngeclient_exec(&e);
-
-    /* check for failures */
-    if (ngeclient_error)
-    {
-	fprintf(stderr, "%s\n", ngeclient_error);
-    }
-
-    /* clean up */
-    ngeclient_close_socket(&e);
-    exit(0);
+	/* set the hooks */
+	e.connect = &connected;
+	e.disconnect = &disconnected;
+	e.service_state_change = &service_change;
+	e.system_state_change = &sys_state;
+	e.initial_service_state = &service_change;
+	e.initial_system_state = &sys_state;
+	e.service_output = &service_output;
+	e.err_msg = &err_msg;
+	e.ping = &ping;
+
+	/* open correct socket */
+	if (strcmp(argv[0], "ngde") == 0)
+		ngeclient_open_socket(&e, NGE_TEST);
+	else
+		ngeclient_open_socket(&e, NGE_REAL);
+
+	/* if open_socket fails, ngeclient_error is set */
+	if (ngeclient_error)
+	{
+		fprintf(stderr, "%s\n", ngeclient_error);
+		exit(1);
+	}
+
+	/* this is the MAIN LOOP for ngeclient */
+	ngeclient_exec(&e);
+
+	/* check for failures */
+	if (ngeclient_error)
+	{
+		fprintf(stderr, "%s\n", ngeclient_error);
+	}
+
+	/* clean up */
+	ngeclient_close_socket(&e);
+	exit(0);
 }

Modified: initng/trunk/plugins/nge/nge_raw.c
==============================================================================
--- initng/trunk/plugins/nge/nge_raw.c	(original)
+++ initng/trunk/plugins/nge/nge_raw.c	Wed Apr  5 23:11:19 2006
@@ -50,54 +50,54 @@
 /* THIS IS MAIN */
 int main(int argc, char *argv[])
 {
-    nge_event e;
-    int got;
+	nge_event e;
+	int got;
 
-    /* Always null this, to reset it */
-    memset(&e, 0, sizeof(e));
+	/* Always null this, to reset it */
+	memset(&e, 0, sizeof(e));
 
-    /* open correct socket */
-    if (strcmp(argv[0], "ngde_raw") == 0)
-	ngeclient_open_socket(&e, NGE_TEST);
-    else
-	ngeclient_open_socket(&e, NGE_REAL);
-
-    /* if open_socket errors, ngeclient_error is set */
-    if (ngeclient_error)
-    {
-	fprintf(stderr, "%s\n", ngeclient_error);
-	exit(1);
-    }
-
-
-    /* poll_for_input will return -1 if socket closes */
-    while ((got = ngeclient_poll_for_input(&e, 10000) >= 0))
-    {
+	/* open correct socket */
+	if (strcmp(argv[0], "ngde_raw") == 0)
+		ngeclient_open_socket(&e, NGE_TEST);
+	else
+		ngeclient_open_socket(&e, NGE_REAL);
+
+	/* if open_socket errors, ngeclient_error is set */
 	if (ngeclient_error)
 	{
-	    fprintf(stderr, "%s\n", ngeclient_error);
-	    ngeclient_error = NULL;
+		fprintf(stderr, "%s\n", ngeclient_error);
+		exit(1);
 	}
 
-	/* if we got something */
-	if (got > 0 && e.read_buffer && e.read_buffer[0])
+
+	/* poll_for_input will return -1 if socket closes */
+	while ((got = ngeclient_poll_for_input(&e, 10000) >= 0))
 	{
-	    fprintf(stdout, "%s", e.read_buffer);
+		if (ngeclient_error)
+		{
+			fprintf(stderr, "%s\n", ngeclient_error);
+			ngeclient_error = NULL;
+		}
+
+		/* if we got something */
+		if (got > 0 && e.read_buffer && e.read_buffer[0])
+		{
+			fprintf(stdout, "%s", e.read_buffer);
+		}
+
+		/* free and reset buffer, so we wont print full history every print. */
+		ngeclient_free_buffer(&e);
 	}
 
-	/* free and reset buffer, so we wont print full history every print. */
-	ngeclient_free_buffer(&e);
-    }
-
-    /* check for error messages from ngeclinet.so */
-    if (ngeclient_error)
-    {
-	fprintf(stderr, "%s\n", ngeclient_error);
-	ngeclient_error = NULL;
-    }
+	/* check for error messages from ngeclinet.so */
+	if (ngeclient_error)
+	{
+		fprintf(stderr, "%s\n", ngeclient_error);
+		ngeclient_error = NULL;
+	}
 
 
-    /* clean up */
-    ngeclient_close_socket(&e);
-    exit(0);
+	/* clean up */
+	ngeclient_close_socket(&e);
+	exit(0);
 }

Modified: initng/trunk/plugins/pause/initng_pause.c
==============================================================================
--- initng/trunk/plugins/pause/initng_pause.c	(original)
+++ initng/trunk/plugins/pause/initng_pause.c	Wed Apr  5 23:11:19 2006
@@ -30,62 +30,62 @@
 #include <assert.h>
 
 s_entry S_DELAY = { "exec_delay", VARIABLE_INT, NULL,
-    "Pause this much seconds before service is launched."
+	"Pause this much seconds before service is launched."
 };
 
 s_entry MS_DELAY = { "exec_m_delay", VARIABLE_INT, NULL,
-    "Pause this much microseconds before service is launched."
+	"Pause this much microseconds before service is launched."
 };
 
 static int do_pause(active_db_h * s, process_h * p)
 {
-    int s_delay = 0;
-    int ms_delay = 0;
+	int s_delay = 0;
+	int ms_delay = 0;
 
-    assert(s);
-    assert(p);
-    assert(p->pt);
+	assert(s);
+	assert(p);
+	assert(p->pt);
 
-    D_(" %s\n", s->name);
+	D_(" %s\n", s->name);
 
 
-    s_delay = get_int_var(&S_DELAY, p->pt->name, s);
-    ms_delay = get_int_var(&MS_DELAY, p->pt->name, s);
+	s_delay = get_int_var(&S_DELAY, p->pt->name, s);
+	ms_delay = get_int_var(&MS_DELAY, p->pt->name, s);
 
 
-    if (s_delay)
-    {
-	D_("Sleeping for %i seconds.\n", s_delay);
-	sleep(s_delay);
-    }
+	if (s_delay)
+	{
+		D_("Sleeping for %i seconds.\n", s_delay);
+		sleep(s_delay);
+	}
 
-    if (ms_delay)
-    {
-	D_("Sleeping for %i milliseconds.\n", ms_delay);
-	usleep(ms_delay);
-    }
+	if (ms_delay)
+	{
+		D_("Sleeping for %i milliseconds.\n", ms_delay);
+		usleep(ms_delay);
+	}
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&S_DELAY);
-    initng_service_data_types_add(&MS_DELAY);
-    return (initng_plugin_hook_add(&g.A_FORK, 90, &do_pause));
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&S_DELAY);
+	initng_service_data_types_add(&MS_DELAY);
+	return (initng_plugin_hook_add(&g.A_FORK, 90, &do_pause));
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&S_DELAY);
-    initng_service_data_types_del(&MS_DELAY);
-    initng_plugin_hook_del(&g.A_FORK, &do_pause);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&S_DELAY);
+	initng_service_data_types_del(&MS_DELAY);
+	initng_plugin_hook_del(&g.A_FORK, &do_pause);
 }

Modified: initng/trunk/plugins/reload/initng_reload.c
==============================================================================
--- initng/trunk/plugins/reload/initng_reload.c	(original)
+++ initng/trunk/plugins/reload/initng_reload.c	Wed Apr  5 23:11:19 2006
@@ -22,7 +22,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <unistd.h>
 #include <assert.h>
@@ -51,70 +51,70 @@
 static void cmd_fast_reload(char *arg);
 
 const char *module_needs[] = {
-    "rlparser",
-    "iparser",
-    NULL
+	"rlparser",
+	"iparser",
+	NULL
 };
 
 s_command FAST_RELOAD = { 'c', "hot_reload", VOID_COMMAND, STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_fast_reload},
-    "Fast Reload"
+	{(void *) &cmd_fast_reload},
+	"Fast Reload"
 };
 
 static int fd_used_by_service(int fd)
 {
-    active_db_h *service = NULL;
+	active_db_h *service = NULL;
 
-    while_active_db(service)
-    {
-	process_h *process = NULL;
-
-	while_processes(process, service)
+	while_active_db(service)
 	{
-	    if (process->out_pipe[0] == fd)
-	    {
-		W_("Wont close fd %i, used by service \"%s\"\n", fd,
-		   service->name);
-		return (TRUE);
-	    }
+		process_h *process = NULL;
+
+		while_processes(process, service)
+		{
+			if (process->out_pipe[0] == fd)
+			{
+				W_("Wont close fd %i, used by service \"%s\"\n", fd,
+				   service->name);
+				return (TRUE);
+			}
+		}
 	}
-    }
-    return (FALSE);
+	return (FALSE);
 }
 
 static void cmd_fast_reload(char *arg)
 {
-    (void) arg;
-    int retval;
-    int i;
-    char *new_argv[4];
-
-    retval = initng_plugin_callers_dump_active_db();
-
-    /* close all fd, exept stdin, stdout, stderr, and that ones that point to our services */
-    for (i = 3; i < 1024; i++)
-    {
-	if (fd_used_by_service(i) == FALSE)
-	    close(i);
-    }
-
-    if (retval == TRUE)
-    {
-	D_("exec()int initng\n");
-	new_argv[0] = i_strdup("/sbin/initng");
-	new_argv[1] = i_strdup("--hot_reload");
-	new_argv[2] = NULL;
-
-	execve("/sbin/initng", new_argv, environ);
-	F_("Failed to reload initng!\n");
-    }
-    else
-    {
-	if (retval == FALSE)
-	    F_("No plugin was willing to dump state\n");
+	(void) arg;
+	int retval;
+	int i;
+	char *new_argv[4];
+
+	retval = initng_plugin_callers_dump_active_db();
+
+	/* close all fd, exept stdin, stdout, stderr, and that ones that point to our services */
+	for (i = 3; i < 1024; i++)
+	{
+		if (fd_used_by_service(i) == FALSE)
+			close(i);
+	}
+
+	if (retval == TRUE)
+	{
+		D_("exec()int initng\n");
+		new_argv[0] = i_strdup("/sbin/initng");
+		new_argv[1] = i_strdup("--hot_reload");
+		new_argv[2] = NULL;
+
+		execve("/sbin/initng", new_argv, environ);
+		F_("Failed to reload initng!\n");
+	}
 	else
-	    F_("dump_state failed!\n");
-    }
+	{
+		if (retval == FALSE)
+			F_("No plugin was willing to dump state\n");
+		else
+			F_("dump_state failed!\n");
+	}
 }
 
 
@@ -122,383 +122,383 @@
    reported incorrectly */
 static int read_file(const char *filename)
 {
-    FILE *fil;
-    int success = TRUE;
+	FILE *fil;
+	int success = TRUE;
 
-    fil = fopen(filename, "r");
-
-    if (!fil)
-	return FALSE;
-
-    while (!feof(fil))
-    {
-	active_db_h *new_entry = NULL;
-	s_data *d = NULL;
-	data_save_struct entry;
+	fil = fopen(filename, "r");
 
-	if (!fread(&entry, sizeof(entry), 1, fil))
-	    continue;
+	if (!fil)
+		return FALSE;
 
-	if (initng_active_db_find_by_name(entry.name))
+	while (!feof(fil))
 	{
-	    W_("Entry exists, won't create it!\n");
-	    continue;
-	}
+		active_db_h *new_entry = NULL;
+		s_data *d = NULL;
+		data_save_struct entry;
 
-	/* create a new service entry */
-	if (!(new_entry = initng_active_db_new(entry.name)))
-	{
-	    F_("Can't create new active!\n");
-	    success = FALSE;
-	    continue;
-	}
+		if (!fread(&entry, sizeof(entry), 1, fil))
+			continue;
 
-	/* set current_state */
-	new_entry->current_state = initng_active_state_find(entry.state);
-	if (!new_entry->current_state)
-	{
-	    F_("Could not find a proper state to set: %s.\n", entry.state);
-	    success = FALSE;
-	    continue;
-	}
+		if (initng_active_db_find_by_name(entry.name))
+		{
+			W_("Entry exists, won't create it!\n");
+			continue;
+		}
 
-	/* set service stype */
-	if (!(new_entry->type = initng_service_types_get(entry.type)))
-	{
-	    F_("Unknown service type %s.\n", entry.type);
-	    success = FALSE;
-	    continue;
-	}
+		/* create a new service entry */
+		if (!(new_entry = initng_active_db_new(entry.name)))
+		{
+			F_("Can't create new active!\n");
+			success = FALSE;
+			continue;
+		}
 
-	/* set time_current_state */
-	memcpy(&new_entry->time_current_state, &entry.time_current_state,
-	       sizeof(struct timeval));
+		/* set current_state */
+		new_entry->current_state = initng_active_state_find(entry.state);
+		if (!new_entry->current_state)
+		{
+			F_("Could not find a proper state to set: %s.\n", entry.state);
+			success = FALSE;
+			continue;
+		}
 
-	/* walk through all processes */
-	{
-	    int pnr = 0;
+		/* set service stype */
+		if (!(new_entry->type = initng_service_types_get(entry.type)))
+		{
+			F_("Unknown service type %s.\n", entry.type);
+			success = FALSE;
+			continue;
+		}
 
-	    while (entry.process[pnr].ptype[0] && pnr < MAX_PROCESSES)
-	    {
-		process_h *process = NULL;
-		ptype_h *pt = NULL;
+		/* set time_current_state */
+		memcpy(&new_entry->time_current_state, &entry.time_current_state,
+			   sizeof(struct timeval));
 
-		while_ptypes(pt)
+		/* walk through all processes */
 		{
-		    if (strcmp(entry.process[pnr].ptype, pt->name) == 0)
-			break;
+			int pnr = 0;
+
+			while (entry.process[pnr].ptype[0] && pnr < MAX_PROCESSES)
+			{
+				process_h *process = NULL;
+				ptype_h *pt = NULL;
+
+				while_ptypes(pt)
+				{
+					if (strcmp(entry.process[pnr].ptype, pt->name) == 0)
+						break;
+				}
+
+				/* check so it was found */
+				if (strcmp(entry.process[pnr].ptype, pt->name) != 0)
+					continue;
+
+				/* allocate the process */
+				process = initng_process_db_new(pt);
+				if (!process)
+					continue;
+
+				/* fill the data */
+				process->pid = entry.process[pnr].pid;
+				process->out_pipe[0] = entry.process[pnr].stdout1;
+				process->out_pipe[1] = entry.process[pnr].stdout2;
+				process->r_code = entry.process[pnr].rcode;
+
+				/* allocate a new output buffer for this process */
+				process->buffer = NULL;
+
+				/* add this process to the list */
+				list_add(&process->list, &new_entry->processes.list);
+
+				D_("Added process type %i to %s\n", process->pt,
+				   new_entry->name);
+
+				pnr++;
+			}
 		}
 
-		/* check so it was found */
-		if (strcmp(entry.process[pnr].ptype, pt->name) != 0)
-		    continue;
+		{
+			int i = 0;
 
-		/* allocate the process */
-		process = initng_process_db_new(pt);
-		if (!process)
-		    continue;
+			while (entry.data[i].opt_type)
+			{
+				d = (s_data *) i_calloc(1, sizeof(s_data));
+				d->type = initng_service_data_types_find(entry.data[i].type);
+				if (!d->type)
+				{
+					F_("Did not found %s!\n", entry.data[i].type);
+					free(d);
+					i++;
+					continue;
+				}
+				switch (d->type->opt_type)
+				{
+					case STRING:
+					case STRINGS:
+					case VARIABLE_STRING:
+					case VARIABLE_STRINGS:
+						d->t.s = i_strdup(entry.data[i].t.s);
+						break;
+					case INT:
+					case VARIABLE_INT:
+						d->t.i = entry.data[i].t.i;
+						break;
+					default:
+						break;
+				}
+				list_add(&d->list, &new_entry->data.head.list);
+				i++;
+			}
+		}
 
-		/* fill the data */
-		process->pid = entry.process[pnr].pid;
-		process->out_pipe[0] = entry.process[pnr].stdout1;
-		process->out_pipe[1] = entry.process[pnr].stdout2;
-		process->r_code = entry.process[pnr].rcode;
+		/* add the new service to the active_db */
+		if (initng_active_db_add(new_entry) != TRUE)
+		{
+			F_("Could not add entry!\n");
+			initng_active_db_free(new_entry);
+			success = FALSE;
+			continue;
+		}
 
-		/* allocate a new output buffer for this process */
-		process->buffer = NULL;
+		/* Don't need to reload data from disk, loaded when needed
+		   if (get_service(new_entry) == TRUE)
+		   new_entry->from_service =
+		   service_db_find_by_name(new_entry->name);
+		 */
+	}
 
-		/* add this process to the list */
-		list_add(&process->list, &new_entry->processes.list);
+	fclose(fil);
+	if (unlink(filename) != 0)
+	{
+		W_("Failed removing file %s !!!\n", filename);
+		return success;						/* not important */
+	}
 
-		D_("Added process type %i to %s\n", process->pt,
-		   new_entry->name);
+	return success;
+}
+static int write_file(const char *filename)
+{
+	FILE *fil;
+	active_db_h *current, *q = NULL;
+	data_save_struct entry;
+	process_h *process = NULL;
+	int i;
+	int pnr = 0;
+	s_data *c_d = NULL;
+	int success = TRUE;
 
-		pnr++;
-	    }
+	fil = fopen(filename, "w+");
+	if (!fil)
+	{
+		F_("Could not open '%s' for writing\n", filename);
+		return FALSE;
 	}
 
+	/* walk the active_db */
+	while_active_db_safe(current, q)
 	{
-	    int i = 0;
+		if (!current->current_state)
+		{
+			F_("State is not set, wont save this one!\n");
+			continue;
+		}
 
-	    while (entry.data[i].opt_type)
-	    {
-		d = (s_data *) i_calloc(1, sizeof(s_data));
-		d->type = initng_service_data_types_find(entry.data[i].type);
-		if (!d->type)
+		if (strlen(current->name) >= MAX_SERVICE_NAME_STRING_LEN)
 		{
-		    F_("Did not found %s!\n", entry.data[i].type);
-		    free(d);
-		    i++;
-		    continue;
+			F_("Service name is to long, it won't fit the fileformat spec! max is %i, won't save this service!\n", MAX_SERVICE_NAME_STRING_LEN);
+			success = FALSE;
+			continue;
 		}
-		switch (d->type->opt_type)
+
+		memset(&entry, 0, sizeof entry);
+		strncpy(entry.name, current->name, MAX_SERVICE_NAME_STRING_LEN);
+		strncpy(entry.state, current->current_state->state_name, 100);
+		strncpy(entry.type, current->type->name, 100);
+		memcpy(&entry.time_current_state, &current->time_current_state,
+			   sizeof(struct timeval));
+
+		/* collect some processes */
+		process = NULL;
+		pnr = 0;
+		while_processes(process, current)
 		{
-		    case STRING:
-		    case STRINGS:
-		    case VARIABLE_STRING:
-		    case VARIABLE_STRINGS:
-			d->t.s = i_strdup(entry.data[i].t.s);
-			break;
-		    case INT:
-		    case VARIABLE_INT:
-			d->t.i = entry.data[i].t.i;
-			break;
-		    default:
-			break;
+			strncpy(entry.process[pnr].ptype, process->pt->name,
+					MAX_PTYPE_STRING_LEN);
+			entry.process[pnr].pid = process->pid;
+			entry.process[pnr].stdout1 = process->out_pipe[0];
+			entry.process[pnr].stdout2 = process->out_pipe[1];
+			entry.process[pnr].rcode = process->r_code;
+			pnr++;
+			if (pnr >= MAX_PROCESSES)
+				break;
 		}
-		list_add(&d->list, &new_entry->data.head.list);
-		i++;
-	    }
-	}
-
-	/* add the new service to the active_db */
-	if (initng_active_db_add(new_entry) != TRUE)
-	{
-	    F_("Could not add entry!\n");
-	    initng_active_db_free(new_entry);
-	    success = FALSE;
-	    continue;
-	}
-
-	/* Don't need to reload data from disk, loaded when needed
-	   if (get_service(new_entry) == TRUE)
-	   new_entry->from_service =
-	   service_db_find_by_name(new_entry->name);
-	 */
-    }
-
-    fclose(fil);
-    if (unlink(filename) != 0)
-    {
-	W_("Failed removing file %s !!!\n", filename);
-	return success;			    /* not important */
-    }
+		entry.process[pnr].ptype[0] = '\0';
 
-    return success;
-}
-static int write_file(const char *filename)
-{
-    FILE *fil;
-    active_db_h *current, *q = NULL;
-    data_save_struct entry;
-    process_h *process = NULL;
-    int i;
-    int pnr = 0;
-    s_data *c_d = NULL;
-    int success = TRUE;
-
-    fil = fopen(filename, "w+");
-    if (!fil)
-    {
-	F_("Could not open '%s' for writing\n", filename);
-	return FALSE;
-    }
-
-    /* walk the active_db */
-    while_active_db_safe(current, q)
-    {
-	if (!current->current_state)
-	{
-	    F_("State is not set, wont save this one!\n");
-	    continue;
-	}
-
-	if (strlen(current->name) >= MAX_SERVICE_NAME_STRING_LEN)
-	{
-	    F_("Service name is to long, it won't fit the fileformat spec! max is %i, won't save this service!\n", MAX_SERVICE_NAME_STRING_LEN);
-	    success = FALSE;
-	    continue;
-	}
-
-	memset(&entry, 0, sizeof entry);
-	strncpy(entry.name, current->name, MAX_SERVICE_NAME_STRING_LEN);
-	strncpy(entry.state, current->current_state->state_name, 100);
-	strncpy(entry.type, current->type->name, 100);
-	memcpy(&entry.time_current_state, &current->time_current_state,
-	       sizeof(struct timeval));
-
-	/* collect some processes */
-	process = NULL;
-	pnr = 0;
-	while_processes(process, current)
-	{
-	    strncpy(entry.process[pnr].ptype, process->pt->name,
-		    MAX_PTYPE_STRING_LEN);
-	    entry.process[pnr].pid = process->pid;
-	    entry.process[pnr].stdout1 = process->out_pipe[0];
-	    entry.process[pnr].stdout2 = process->out_pipe[1];
-	    entry.process[pnr].rcode = process->r_code;
-	    pnr++;
-	    if (pnr >= MAX_PROCESSES)
-		break;
-	}
-	entry.process[pnr].ptype[0] = '\0';
-
-	/* reset data */
-	for (i = 0; i < MAX_ENTRYS_FOR_SERVICE; i++)
-	{
-	    entry.data[i].opt_type = 0;
-	    entry.data[i].type[0] = '\0';
-	    entry.data[i].t.i = 0;
-	}
-
-	i = 0;
-	list_for_each_entry(c_d, &current->data.head.list, list)
-	{
-	    if (!c_d->type)
-		continue;
-	    if (!c_d->type->opt_name)
-		continue;
-
-	    entry.data[i].opt_type = c_d->type->opt_type;
-	    strncpy(entry.data[i].type, c_d->type->opt_name,
-		    MAX_TYPE_STRING_LEN);
-
-	    /* copy the data */
-	    switch (c_d->type->opt_type)
-	    {
-		case STRING:
-		case STRINGS:
-		case VARIABLE_STRING:
-		case VARIABLE_STRINGS:
-		    strncpy(entry.data[i].t.s, c_d->t.s, MAX_DATA_STRING_LEN);
-		    break;
-		case INT:
-		case VARIABLE_INT:
-		    entry.data[i].t.i = c_d->t.i;
-		    break;
-		default:
-		    break;
-	    }
-
-	    /* save in next data entry row */
-	    i++;
-
-	    /* maximum data entries that can be saved */
-	    if (i == MAX_ENTRYS_FOR_SERVICE)
-	    {
-		F_("Maximum 20 data entries / service can't be saved!\n");
-		success = FALSE;
-		break;
-	    }
-	}
-
-	D_("Saving : %s\n", entry.name);
-	if (fwrite(&entry, sizeof(entry), 1, fil) != 1)
-	{
-	    F_("failed to write entry '%s': %m\n", entry.name);
-	    /* TODO: database recovery?? */
-	    success = FALSE;
-	    break;
+		/* reset data */
+		for (i = 0; i < MAX_ENTRYS_FOR_SERVICE; i++)
+		{
+			entry.data[i].opt_type = 0;
+			entry.data[i].type[0] = '\0';
+			entry.data[i].t.i = 0;
+		}
+
+		i = 0;
+		list_for_each_entry(c_d, &current->data.head.list, list)
+		{
+			if (!c_d->type)
+				continue;
+			if (!c_d->type->opt_name)
+				continue;
+
+			entry.data[i].opt_type = c_d->type->opt_type;
+			strncpy(entry.data[i].type, c_d->type->opt_name,
+					MAX_TYPE_STRING_LEN);
+
+			/* copy the data */
+			switch (c_d->type->opt_type)
+			{
+				case STRING:
+				case STRINGS:
+				case VARIABLE_STRING:
+				case VARIABLE_STRINGS:
+					strncpy(entry.data[i].t.s, c_d->t.s, MAX_DATA_STRING_LEN);
+					break;
+				case INT:
+				case VARIABLE_INT:
+					entry.data[i].t.i = c_d->t.i;
+					break;
+				default:
+					break;
+			}
+
+			/* save in next data entry row */
+			i++;
+
+			/* maximum data entries that can be saved */
+			if (i == MAX_ENTRYS_FOR_SERVICE)
+			{
+				F_("Maximum 20 data entries / service can't be saved!\n");
+				success = FALSE;
+				break;
+			}
+		}
+
+		D_("Saving : %s\n", entry.name);
+		if (fwrite(&entry, sizeof(entry), 1, fil) != 1)
+		{
+			F_("failed to write entry '%s': %m\n", entry.name);
+			/* TODO: database recovery?? */
+			success = FALSE;
+			break;
+		}
 	}
-    }
 
-    fclose(fil);
-    return success;
+	fclose(fil);
+	return success;
 }
 
 static int dump_state(void)
 {
-    int retval;
+	int retval;
 
-    if (g.i_am_init)
-    {
-	retval = write_file(SAVE_FILE);
-    }
-    else
-    {
-	retval = write_file(SAVE_FILE_FAKE);
-    }
-    return retval ? TRUE : FAIL;
+	if (g.i_am_init)
+	{
+		retval = write_file(SAVE_FILE);
+	}
+	else
+	{
+		retval = write_file(SAVE_FILE_FAKE);
+	}
+	return retval ? TRUE : FAIL;
 }
 
 static int reload_state(void)
 {
-    struct stat st;
-    int retval;
-
-    if (stat(g.i_am_init ? SAVE_FILE : SAVE_FILE_FAKE, &st))
-    {
-	D_("No state file found, passing on reload_state request\n");
-	return FALSE;
-    }
-    if (g.i_am_init)
-    {
-	retval = read_file(SAVE_FILE);
-    }
-    else
-    {
-	retval = read_file(SAVE_FILE_FAKE);
-    }
-    return retval ? TRUE : FAIL;
-}
+	struct stat st;
+	int retval;
 
-/* Save a reload file for backup if initng segfaults */
-static void save_backup(h_sys_state state)
-{
-    /* only save when system is getting up */
-    if (state == STATE_UP)
-    {
-	/* save file */
+	if (stat(g.i_am_init ? SAVE_FILE : SAVE_FILE_FAKE, &st))
+	{
+		D_("No state file found, passing on reload_state request\n");
+		return FALSE;
+	}
 	if (g.i_am_init)
 	{
-	    write_file(SAVE_FILE);
+		retval = read_file(SAVE_FILE);
 	}
 	else
 	{
-	    write_file(SAVE_FILE_FAKE);
+		retval = read_file(SAVE_FILE_FAKE);
 	}
-	return;
-    }
+	return retval ? TRUE : FAIL;
+}
 
-    /* if system is stopping, remove the SAVE_FILE */
-    if (state == STATE_STOPPING)
-    {
-	if (g.i_am_init)
+/* Save a reload file for backup if initng segfaults */
+static void save_backup(h_sys_state state)
+{
+	/* only save when system is getting up */
+	if (state == STATE_UP)
 	{
-	    unlink(SAVE_FILE);
+		/* save file */
+		if (g.i_am_init)
+		{
+			write_file(SAVE_FILE);
+		}
+		else
+		{
+			write_file(SAVE_FILE_FAKE);
+		}
+		return;
 	}
-	else
+
+	/* if system is stopping, remove the SAVE_FILE */
+	if (state == STATE_STOPPING)
 	{
-	    unlink(SAVE_FILE_FAKE);
+		if (g.i_am_init)
+		{
+			unlink(SAVE_FILE);
+		}
+		else
+		{
+			unlink(SAVE_FILE_FAKE);
+		}
+		return;
 	}
-	return;
-    }
 }
 
 int module_init(int api_version)
 {
-    D_("module_init(reload);\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init(reload);\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    /*    if (g.hot_reload)
-       {
-       if (g.i_am_init)
-       {
-       read_file(SAVE_FILE);
-       }
-       else
-       {
-       read_file(SAVE_FILE_FAKE);
-       }
-       } */
-
-    initng_plugin_hook_add(&g.SWATCHERS, 90, &save_backup);
-    initng_plugin_hook_add(&g.DUMP_ACTIVE_DB, 10, &dump_state);
-    initng_plugin_hook_add(&g.RELOAD_ACTIVE_DB, 10, &reload_state);
-    initng_command_add(&FAST_RELOAD);
-    return (TRUE);
+	/*    if (g.hot_reload)
+	   {
+	   if (g.i_am_init)
+	   {
+	   read_file(SAVE_FILE);
+	   }
+	   else
+	   {
+	   read_file(SAVE_FILE_FAKE);
+	   }
+	   } */
+
+	initng_plugin_hook_add(&g.SWATCHERS, 90, &save_backup);
+	initng_plugin_hook_add(&g.DUMP_ACTIVE_DB, 10, &dump_state);
+	initng_plugin_hook_add(&g.RELOAD_ACTIVE_DB, 10, &reload_state);
+	initng_command_add(&FAST_RELOAD);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_plugin_hook_del(&g.SWATCHERS, &save_backup);
-    initng_plugin_hook_del(&g.DUMP_ACTIVE_DB, &dump_state);
-    initng_plugin_hook_del(&g.RELOAD_ACTIVE_DB, &reload_state);
-    initng_command_del(&FAST_RELOAD);
+	D_("module_unload();\n");
+	initng_plugin_hook_del(&g.SWATCHERS, &save_backup);
+	initng_plugin_hook_del(&g.DUMP_ACTIVE_DB, &dump_state);
+	initng_plugin_hook_del(&g.RELOAD_ACTIVE_DB, &reload_state);
+	initng_command_del(&FAST_RELOAD);
 }

Modified: initng/trunk/plugins/reload/initng_reload.h
==============================================================================
--- initng/trunk/plugins/reload/initng_reload.h	(original)
+++ initng/trunk/plugins/reload/initng_reload.h	Wed Apr  5 23:11:19 2006
@@ -33,35 +33,35 @@
 
 typedef struct
 {
-    char type[MAX_TYPE_STRING_LEN + 1];
-    e_dt opt_type;
-    union
-    {
-	char s[MAX_DATA_STRING_LEN + 1];
-	int i;
-    } t;
+	char type[MAX_TYPE_STRING_LEN + 1];
+	e_dt opt_type;
+	union
+	{
+		char s[MAX_DATA_STRING_LEN + 1];
+		int i;
+	} t;
 } r_d_e;
 
 typedef struct
 {
-    char ptype[MAX_PTYPE_STRING_LEN + 1];
-    int stdout1;
-    int stdout2;
-    int pid;
-    int rcode;
+	char ptype[MAX_PTYPE_STRING_LEN + 1];
+	int stdout1;
+	int stdout2;
+	int pid;
+	int rcode;
 } r_process;
 
 /* this lines will the active contain */
 typedef struct
 {
-    char name[MAX_SERVICE_NAME_STRING_LEN + 1];
-    char type[MAX_TYPE_STRING_LEN + 1];
-    char state[101];
-    struct timeval time_current_state;
+	char name[MAX_SERVICE_NAME_STRING_LEN + 1];
+	char type[MAX_TYPE_STRING_LEN + 1];
+	char state[101];
+	struct timeval time_current_state;
 
-    /*  struct with some processes */
-    r_process process[MAX_PROCESSES];
+	/*  struct with some processes */
+	r_process process[MAX_PROCESSES];
 
-    /* struct with some data */
-    r_d_e data[MAX_ENTRYS_FOR_SERVICE + 1];
+	/* struct with some data */
+	r_d_e data[MAX_ENTRYS_FOR_SERVICE + 1];
 } data_save_struct;

Modified: initng/trunk/plugins/renice/initng_renice.c
==============================================================================
--- initng/trunk/plugins/renice/initng_renice.c	(original)
+++ initng/trunk/plugins/renice/initng_renice.c	Wed Apr  5 23:11:19 2006
@@ -35,39 +35,39 @@
 
 static int do_renice(active_db_h * s, process_h * p __attribute__ ((unused)))
 {
-    assert(s);
-    assert(s->name);
-    assert(p);
+	assert(s);
+	assert(s->name);
+	assert(p);
 
-    if (is(&NICE, s))
-    {
-	D_("Will renice %s to %i !\n", s->name, get_int(&NICE, s));
-	errno = 0;
-	if (nice(get_int(&NICE, s)) == -1 && errno != 0)
+	if (is(&NICE, s))
 	{
-	    F_("Failed to set the nice value: %s\n", strerror(errno));
-	    return FALSE;
+		D_("Will renice %s to %i !\n", s->name, get_int(&NICE, s));
+		errno = 0;
+		if (nice(get_int(&NICE, s)) == -1 && errno != 0)
+		{
+			F_("Failed to set the nice value: %s\n", strerror(errno));
+			return FALSE;
+		}
 	}
-    }
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_service_data_types_add(&NICE);
-    return (initng_plugin_hook_add(&g.A_FORK, 50, &do_renice));
+	initng_service_data_types_add(&NICE);
+	return (initng_plugin_hook_add(&g.A_FORK, 50, &do_renice));
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&NICE);
-    initng_plugin_hook_del(&g.A_FORK, &do_renice);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&NICE);
+	initng_plugin_hook_del(&g.A_FORK, &do_renice);
 }

Modified: initng/trunk/plugins/rlparser/initng_rl_parser.c
==============================================================================
--- initng/trunk/plugins/rlparser/initng_rl_parser.c	(original)
+++ initng/trunk/plugins/rlparser/initng_rl_parser.c	Wed Apr  5 23:11:19 2006
@@ -46,70 +46,70 @@
 stype_h *TYPE_VIRTUAL;
 
 static service_cache_h *parse_file(char *filetoparse,
-				   const char *runlevel_name, stype_h * type)
+								   const char *runlevel_name, stype_h * type)
 {
-    service_cache_h *n_service;	/* service struct pointer too   */
-    char *w = NULL;
-    char *a = NULL;
-    char *w_depends = NULL;
-
-    /* allocate a new service */
-    if (!(n_service = initng_service_cache_new(runlevel_name, type)))
-    {
-	free(filetoparse);
-	return (NULL);
-    }
-
-    /* copy file filename into allocated file_buf */
-    if (!open_read_close(filetoparse, &w_depends))
-    {
-	D_("parse_file(%s): Can't open config file!\n", filetoparse);
-	if (n_service->name)
-	    free(n_service->name);
-
-	/* free all data entries */
-	dfree_all(n_service);
-
-	if (n_service)
-	    free(n_service);
-	free(filetoparse);
-	return (NULL);
-    }
-    w = w_depends;
-
-    while (w[0] != '\0')
-    {
-	/* skip leading spaces */
-	JUMP_SPACES(w);
-	if (w[0] == '\0')
-	    break;
+	service_cache_h *n_service;	/* service struct pointer too   */
+	char *w = NULL;
+	char *a = NULL;
+	char *w_depends = NULL;
 
-	/* skip lines, starting with '#' */
-	if (w[0] == '#')
+	/* allocate a new service */
+	if (!(n_service = initng_service_cache_new(runlevel_name, type)))
 	{
-	    JUMP_TO_NEXT_ROW(w);
-	    continue;
+		free(filetoparse);
+		return (NULL);
 	}
 
-	a = st_dup_line(&w);
-	if (a)
+	/* copy file filename into allocated file_buf */
+	if (!open_read_close(filetoparse, &w_depends))
 	{
-	    D_("adding dep: \"%s\"\n", a);
-	    set_another_string(&NEED, n_service, a);
+		D_("parse_file(%s): Can't open config file!\n", filetoparse);
+		if (n_service->name)
+			free(n_service->name);
+
+		/* free all data entries */
+		dfree_all(n_service);
+
+		if (n_service)
+			free(n_service);
+		free(filetoparse);
+		return (NULL);
 	}
+	w = w_depends;
 
-	JUMP_TO_NEXT_ROW(w);
-    }
+	while (w[0] != '\0')
+	{
+		/* skip leading spaces */
+		JUMP_SPACES(w);
+		if (w[0] == '\0')
+			break;
+
+		/* skip lines, starting with '#' */
+		if (w[0] == '#')
+		{
+			JUMP_TO_NEXT_ROW(w);
+			continue;
+		}
+
+		a = st_dup_line(&w);
+		if (a)
+		{
+			D_("adding dep: \"%s\"\n", a);
+			set_another_string(&NEED, n_service, a);
+		}
 
-    free(w_depends);
+		JUMP_TO_NEXT_ROW(w);
+	}
 
-    set_string(&FROM_FILE, n_service, i_strdup(filetoparse));
+	free(w_depends);
 
-    free(filetoparse);
+	set_string(&FROM_FILE, n_service, i_strdup(filetoparse));
 
-    if (initng_service_cache_add(n_service))
-	return (n_service);
-    return (NULL);
+	free(filetoparse);
+
+	if (initng_service_cache_add(n_service))
+		return (n_service);
+	return (NULL);
 
 
 
@@ -119,75 +119,75 @@
 /* a simple parser for a runlevel file */
 static service_cache_h *initng_rl_parser(const char *runlevel_name)
 {
-    char *filetoparse = NULL;
-    struct stat file_stat;
+	char *filetoparse = NULL;
+	struct stat file_stat;
 
 
-    assert(runlevel_name);
+	assert(runlevel_name);
 
-    /* make sure service type RUNLEVEL is set */
-    if (!TYPE_RUNLEVEL)
-    {
-	TYPE_RUNLEVEL = initng_service_types_get("runlevel");
+	/* make sure service type RUNLEVEL is set */
 	if (!TYPE_RUNLEVEL)
 	{
-	    F_("ERROR, runlevel servicetype is not found, make sure runlevel plugin is loaded.\n");
-	    return (NULL);
+		TYPE_RUNLEVEL = initng_service_types_get("runlevel");
+		if (!TYPE_RUNLEVEL)
+		{
+			F_("ERROR, runlevel servicetype is not found, make sure runlevel plugin is loaded.\n");
+			return (NULL);
+		}
 	}
-    }
 
-    if (!TYPE_VIRTUAL)
-    {
-	TYPE_VIRTUAL = initng_service_types_get("virtual");
 	if (!TYPE_VIRTUAL)
 	{
-	    F_("ERROR, virtual servicetype is not found, make sure runlevel plugin is loaded.\n");
-	    return (NULL);
+		TYPE_VIRTUAL = initng_service_types_get("virtual");
+		if (!TYPE_VIRTUAL)
+		{
+			F_("ERROR, virtual servicetype is not found, make sure runlevel plugin is loaded.\n");
+			return (NULL);
+		}
 	}
-    }
 
-    filetoparse = (char *) i_calloc(strlen(INITNG_ROOT) + 1 +
-				    strlen(runlevel_name) + 10, sizeof(char));
+	filetoparse = (char *) i_calloc(strlen(INITNG_ROOT) + 1 +
+									strlen(runlevel_name) + 10, sizeof(char));
+
+	/* check /etc/initng/name.virtual */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, runlevel_name);
+	strcat(filetoparse, ".virtual");
+
+	if (stat(filetoparse, &file_stat) == 0 && S_ISREG(file_stat.st_mode))
+	{
+		return (parse_file(filetoparse, runlevel_name, TYPE_VIRTUAL));
+	}
 
-    /* check /etc/initng/name.virtual */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, runlevel_name);
-    strcat(filetoparse, ".virtual");
-
-    if (stat(filetoparse, &file_stat) == 0 && S_ISREG(file_stat.st_mode))
-    {
-	return (parse_file(filetoparse, runlevel_name, TYPE_VIRTUAL));
-    }
-
-    /* check /etc/initng/name.runlevel */
-    strcpy(filetoparse, INITNG_ROOT "/");
-    strcat(filetoparse, runlevel_name);
-    strcat(filetoparse, ".runlevel");
-
-    if (stat(filetoparse, &file_stat) == 0 && S_ISREG(file_stat.st_mode))
-    {
-	return (parse_file(filetoparse, runlevel_name, TYPE_RUNLEVEL));
-    }
+	/* check /etc/initng/name.runlevel */
+	strcpy(filetoparse, INITNG_ROOT "/");
+	strcat(filetoparse, runlevel_name);
+	strcat(filetoparse, ".runlevel");
 
-    return (NULL);
+	if (stat(filetoparse, &file_stat) == 0 && S_ISREG(file_stat.st_mode))
+	{
+		return (parse_file(filetoparse, runlevel_name, TYPE_RUNLEVEL));
+	}
+
+	return (NULL);
 }
 
 int module_init(int api_version)
 {
-    /* initziate globals */
-    TYPE_RUNLEVEL = NULL;
+	/* initziate globals */
+	TYPE_RUNLEVEL = NULL;
 
-    D_("initng_rl_parser: module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("initng_rl_parser: module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    return (initng_plugin_hook_add(&g.PARSERS, 60, &initng_rl_parser));
+	return (initng_plugin_hook_add(&g.PARSERS, 60, &initng_rl_parser));
 }
 
 void module_unload(void)
 {
-    initng_plugin_hook_del(&g.PARSERS, &initng_rl_parser);
+	initng_plugin_hook_del(&g.PARSERS, &initng_rl_parser);
 }

Modified: initng/trunk/plugins/runlevel/initng_runlevel.c
==============================================================================
--- initng/trunk/plugins/runlevel/initng_runlevel.c	(original)
+++ initng/trunk/plugins/runlevel/initng_runlevel.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 /*#include <time.h> */
@@ -91,14 +91,14 @@
  * When services needed by current one is starting, current service is set RUNLEVEL_WAITING_FOR_START_DEP
  */
 a_state_h RUNLEVEL_WAITING_FOR_START_DEP = { "WAITING_FOR_START_DEP", IS_STARTING,
-    &handle_RUNLEVEL_WAITING_FOR_START_DEP, NULL, NULL
+	&handle_RUNLEVEL_WAITING_FOR_START_DEP, NULL, NULL
 };
 
 /*
  * When services needed to stop, before this is stopped is stopping, current service is set RUNLEVEL_WAITING_FOR_STOP_DEP
  */
 a_state_h RUNLEVEL_WAITING_FOR_STOP_DEP = { "WAITING_FOR_STOP_DEP", IS_STOPPING,
-    &handle_RUNLEVEL_WAITING_FOR_STOP_DEP, NULL, NULL
+	&handle_RUNLEVEL_WAITING_FOR_STOP_DEP, NULL, NULL
 };
 
 /*
@@ -125,23 +125,23 @@
 static int start_RUNLEVEL(active_db_h * service)
 {
 
-    /* if not yet stopped */
-    if (IS_MARK(service, &RUNLEVEL_WAITING_FOR_STOP_DEP))
-    {
-	initng_common_mark_service(service, &RUNLEVEL_UP);
-	return (TRUE);
-    }
+	/* if not yet stopped */
+	if (IS_MARK(service, &RUNLEVEL_WAITING_FOR_STOP_DEP))
+	{
+		initng_common_mark_service(service, &RUNLEVEL_UP);
+		return (TRUE);
+	}
 
-    /* mark it WAITING_FOR_START_DEP and wait */
-    if (!initng_common_mark_service(service, &RUNLEVEL_START_MARKED))
-    {
-	W_("mark_service RUNLEVEL_START_MARKED failed for service %s\n",
-	   service->name);
-	return (FALSE);
-    }
+	/* mark it WAITING_FOR_START_DEP and wait */
+	if (!initng_common_mark_service(service, &RUNLEVEL_START_MARKED))
+	{
+		W_("mark_service RUNLEVEL_START_MARKED failed for service %s\n",
+		   service->name);
+		return (FALSE);
+	}
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
@@ -149,23 +149,23 @@
 static int stop_RUNLEVEL(active_db_h * service)
 {
 
-    /* if not yet stopped */
-    if (IS_MARK(service, &RUNLEVEL_WAITING_FOR_START_DEP))
-    {
-	initng_common_mark_service(service, &RUNLEVEL_DOWN);
-	return (TRUE);
-    }
+	/* if not yet stopped */
+	if (IS_MARK(service, &RUNLEVEL_WAITING_FOR_START_DEP))
+	{
+		initng_common_mark_service(service, &RUNLEVEL_DOWN);
+		return (TRUE);
+	}
 
-    /* set stopping */
-    if (!initng_common_mark_service(service, &RUNLEVEL_STOP_MARKED))
-    {
-	W_("mark_service RUNLEVEL_STOP_MARKED failed for service %s.\n",
-	   service->name);
-	return (FALSE);
-    }
+	/* set stopping */
+	if (!initng_common_mark_service(service, &RUNLEVEL_STOP_MARKED))
+	{
+		W_("mark_service RUNLEVEL_STOP_MARKED failed for service %s.\n",
+		   service->name);
+		return (FALSE);
+	}
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 /*
@@ -176,48 +176,48 @@
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_types_add(&TYPE_RUNLEVEL);
-    initng_service_types_add(&TYPE_VIRTUAL);
-
-
-    initng_active_state_add(&RUNLEVEL_START_MARKED);
-    initng_active_state_add(&RUNLEVEL_STOP_MARKED);
-    initng_active_state_add(&RUNLEVEL_UP);
-    initng_active_state_add(&RUNLEVEL_WAITING_FOR_START_DEP);
-    initng_active_state_add(&RUNLEVEL_WAITING_FOR_STOP_DEP);
-    initng_active_state_add(&RUNLEVEL_DOWN);
-    initng_active_state_add(&RUNLEVEL_START_DEPS_FAILED);
-    initng_active_state_add(&RUNLEVEL_FAIL_STARTING);
-    initng_active_state_add(&RUNLEVEL_FAIL_STOPPING);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
+	initng_service_types_add(&TYPE_RUNLEVEL);
+	initng_service_types_add(&TYPE_VIRTUAL);
 
-    return (TRUE);
+
+	initng_active_state_add(&RUNLEVEL_START_MARKED);
+	initng_active_state_add(&RUNLEVEL_STOP_MARKED);
+	initng_active_state_add(&RUNLEVEL_UP);
+	initng_active_state_add(&RUNLEVEL_WAITING_FOR_START_DEP);
+	initng_active_state_add(&RUNLEVEL_WAITING_FOR_STOP_DEP);
+	initng_active_state_add(&RUNLEVEL_DOWN);
+	initng_active_state_add(&RUNLEVEL_START_DEPS_FAILED);
+	initng_active_state_add(&RUNLEVEL_FAIL_STARTING);
+	initng_active_state_add(&RUNLEVEL_FAIL_STOPPING);
+
+
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    initng_service_types_del(&TYPE_RUNLEVEL);
-    initng_service_types_del(&TYPE_VIRTUAL);
+	initng_service_types_del(&TYPE_RUNLEVEL);
+	initng_service_types_del(&TYPE_VIRTUAL);
 
 
-    initng_active_state_del(&RUNLEVEL_START_MARKED);
-    initng_active_state_del(&RUNLEVEL_STOP_MARKED);
-    initng_active_state_del(&RUNLEVEL_UP);
-    initng_active_state_del(&RUNLEVEL_WAITING_FOR_START_DEP);
-    initng_active_state_del(&RUNLEVEL_WAITING_FOR_STOP_DEP);
-    initng_active_state_del(&RUNLEVEL_DOWN);
-    initng_active_state_del(&RUNLEVEL_START_DEPS_FAILED);
-    initng_active_state_del(&RUNLEVEL_FAIL_STARTING);
-    initng_active_state_del(&RUNLEVEL_FAIL_STOPPING);
+	initng_active_state_del(&RUNLEVEL_START_MARKED);
+	initng_active_state_del(&RUNLEVEL_STOP_MARKED);
+	initng_active_state_del(&RUNLEVEL_UP);
+	initng_active_state_del(&RUNLEVEL_WAITING_FOR_START_DEP);
+	initng_active_state_del(&RUNLEVEL_WAITING_FOR_STOP_DEP);
+	initng_active_state_del(&RUNLEVEL_DOWN);
+	initng_active_state_del(&RUNLEVEL_START_DEPS_FAILED);
+	initng_active_state_del(&RUNLEVEL_FAIL_STARTING);
+	initng_active_state_del(&RUNLEVEL_FAIL_STOPPING);
 
 }
 
@@ -233,82 +233,82 @@
  */
 static void init_RUNLEVEL_START_MARKED(active_db_h * new_runlevel)
 {
-    /* Start our dependencies */
-    initng_depend_start_deps(new_runlevel);
-
+	/* Start our dependencies */
+	initng_depend_start_deps(new_runlevel);
 
-    /* Make sure there will only exist 1 runlevel on the system */
-    if (new_runlevel->type == &TYPE_RUNLEVEL)
-    {
-	active_db_h *current = NULL;
-	active_db_h *old_runlevel = NULL;
 
-	/* STEP 1, Go find old runlevel, shud be only one */
-	while_active_db(current)
+	/* Make sure there will only exist 1 runlevel on the system */
+	if (new_runlevel->type == &TYPE_RUNLEVEL)
 	{
-	    /* dont look for myself */
-	    if (current == new_runlevel)
-		continue;
-
-	    if (current->type == &TYPE_RUNLEVEL)
-	    {
-		old_runlevel = current;
-		break;
-	    }
-	}
-
-	/* if an old runlevel was found */
-	if (old_runlevel)
-	{
-	    const char *dep_old = NULL;
-	    s_data *itt_old = NULL;
-
-	    /* STEP 2, Stop all old runlevel deps, that are not deps of new runlevel */
-
-	    /* for every dep the old runlevel have */
-	    while ((dep_old = get_next_string(&NEED, old_runlevel, &itt_old)))
-	    {
-		const char *dep_new = NULL;
-		s_data *itt_new = NULL;
-		int found = 0;
+		active_db_h *current = NULL;
+		active_db_h *old_runlevel = NULL;
 
-		while ((dep_new =
-			get_next_string(&NEED, new_runlevel, &itt_new)))
+		/* STEP 1, Go find old runlevel, shud be only one */
+		while_active_db(current)
 		{
-		    /* if it matches */
-		    if (strcmp(dep_new, dep_old) == 0)
-		    {
-			found = 1;
-			break;
-		    }
+			/* dont look for myself */
+			if (current == new_runlevel)
+				continue;
+
+			if (current->type == &TYPE_RUNLEVEL)
+			{
+				old_runlevel = current;
+				break;
+			}
 		}
 
-
-		/* If the service found in old runlevel, does not exsist i new one, stop it */
-		if (found == 0)
+		/* if an old runlevel was found */
+		if (old_runlevel)
 		{
-		    active_db_h *service_to_stop = initng_active_db_find_by_name(dep_old);
+			const char *dep_old = NULL;
+			s_data *itt_old = NULL;
 
-		    if (service_to_stop)
-		    {
-			W_("Stopping service %s, not in new service %s\n",
-			   service_to_stop->name, new_runlevel->name);
-			initng_handler_stop_service(service_to_stop);
-		    }
-		}
-	    }
-	    /* check that it also exists in new runlevel */
+			/* STEP 2, Stop all old runlevel deps, that are not deps of new runlevel */
 
+			/* for every dep the old runlevel have */
+			while ((dep_old = get_next_string(&NEED, old_runlevel, &itt_old)))
+			{
+				const char *dep_new = NULL;
+				s_data *itt_new = NULL;
+				int found = 0;
+
+				while ((dep_new =
+						get_next_string(&NEED, new_runlevel, &itt_new)))
+				{
+					/* if it matches */
+					if (strcmp(dep_new, dep_old) == 0)
+					{
+						found = 1;
+						break;
+					}
+				}
+
+
+				/* If the service found in old runlevel, does not exsist i new one, stop it */
+				if (found == 0)
+				{
+					active_db_h *service_to_stop = initng_active_db_find_by_name(dep_old);
+
+					if (service_to_stop)
+					{
+						W_("Stopping service %s, not in new service %s\n",
+						   service_to_stop->name, new_runlevel->name);
+						initng_handler_stop_service(service_to_stop);
+					}
+				}
+			}
+			/* check that it also exists in new runlevel */
 
-	    /* STEP 3, Stop old runlevel */
-	    initng_handler_stop_service(old_runlevel);
+
+			/* STEP 3, Stop old runlevel */
+			initng_handler_stop_service(old_runlevel);
+		}
+		free(g.runlevel);
+		g.runlevel = NULL;
+		g.runlevel = i_strdup(new_runlevel->name);
 	}
-	free(g.runlevel);
-	g.runlevel = NULL;
-	g.runlevel = i_strdup(new_runlevel->name);
-    }
 
-    initng_common_mark_service(new_runlevel, &RUNLEVEL_WAITING_FOR_START_DEP);
+	initng_common_mark_service(new_runlevel, &RUNLEVEL_WAITING_FOR_START_DEP);
 }
 
 /*
@@ -316,59 +316,59 @@
  */
 static void init_RUNLEVEL_STOP_MARKED(active_db_h * service)
 {
-    /* Stopp all services dependeing on this service */
-    initng_depend_stop_deps(service);
+	/* Stopp all services dependeing on this service */
+	initng_depend_stop_deps(service);
 
-    initng_common_mark_service(service, &RUNLEVEL_WAITING_FOR_STOP_DEP);
+	initng_common_mark_service(service, &RUNLEVEL_WAITING_FOR_STOP_DEP);
 }
 
 static void handle_RUNLEVEL_WAITING_FOR_START_DEP(active_db_h * service)
 {
-    assert(service);
+	assert(service);
 
-    /* this checks with external plug-ins, if its ok to start this service now */
+	/* this checks with external plug-ins, if its ok to start this service now */
 
-    switch (initng_depend_start_dep_met(service, FALSE))
-    {
-	    /* if not met, youst return */
-	case FALSE:
-	    return;
-
-
-	    /* set FAILURE */
-	case FAIL:
-	    initng_common_mark_service(service, &RUNLEVEL_START_DEPS_FAILED);
-	    return;
-
-	    /* if met, continue */
-	case TRUE:
-	default:
-	    break;
-    }
+	switch (initng_depend_start_dep_met(service, FALSE))
+	{
+			/* if not met, youst return */
+		case FALSE:
+			return;
+
+
+			/* set FAILURE */
+		case FAIL:
+			initng_common_mark_service(service, &RUNLEVEL_START_DEPS_FAILED);
+			return;
+
+			/* if met, continue */
+		case TRUE:
+		default:
+			break;
+	}
 
-    /* set status to START_DEP_MET */
-    initng_common_mark_service(service, &RUNLEVEL_UP);
+	/* set status to START_DEP_MET */
+	initng_common_mark_service(service, &RUNLEVEL_UP);
 
 }
 
 static void handle_RUNLEVEL_WAITING_FOR_STOP_DEP(active_db_h * service)
 {
-    assert(service);
+	assert(service);
 
-    /* check with other plug-ins, if it is ok to stop this service now */
-    switch (initng_depend_stop_dep_met(service, FALSE))
-    {
-	    /* deps not met, youst return */
-	case FALSE:
-	    return;
-
-	    /* if met, youst continue */
-	case TRUE:
-	default:
-	    break;
+	/* check with other plug-ins, if it is ok to stop this service now */
+	switch (initng_depend_stop_dep_met(service, FALSE))
+	{
+			/* deps not met, youst return */
+		case FALSE:
+			return;
+
+			/* if met, youst continue */
+		case TRUE:
+		default:
+			break;
 
-    }
+	}
 
-    /* ok, stopping deps are met */
-    initng_common_mark_service(service, &RUNLEVEL_DOWN);
+	/* ok, stopping deps are met */
+	initng_common_mark_service(service, &RUNLEVEL_DOWN);
 }

Modified: initng/trunk/plugins/service/initng_service.c
==============================================================================
--- initng/trunk/plugins/service/initng_service.c	(original)
+++ initng/trunk/plugins/service/initng_service.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 #include <sys/types.h>
@@ -74,9 +74,9 @@
  * ############################################################################
  */
 static void handle_killed_start(active_db_h * killed_service,
-				process_h * process);
+								process_h * process);
 static void handle_killed_stop(active_db_h * killed_service,
-			       process_h * process);
+							   process_h * process);
 
 
 /*
@@ -103,19 +103,19 @@
 #define DEFAULT_START_TIMEOUT 240
 #define DEFAULT_STOP_TIMEOUT 60
 s_entry START_TIMEOUT = { "start_timeout", INT, &TYPE_SERVICE,
-    "Let the start process run maximum this time."
+	"Let the start process run maximum this time."
 };
 s_entry STOP_TIMEOUT = { "stop_timeout", INT, &TYPE_SERVICE,
-    "Let the stop process run maximum this time."
+	"Let the stop process run maximum this time."
 };
 s_entry NEVER_KILL = { "never_kill", SET, &TYPE_SERVICE,
-    "This service is to important to be killed by any timeout!"
+	"This service is to important to be killed by any timeout!"
 };
 s_entry START_FAIL_OK = { "start_fail_ok", SET, &TYPE_SERVICE,
-    "Set this service to a succes, even if it returns bad on start service."
+	"Set this service to a succes, even if it returns bad on start service."
 };
 s_entry STOP_FAIL_OK = { "stop_fail_ok", SET, &TYPE_SERVICE,
-    "Set this service to stopped even if it returns bad on stop service."
+	"Set this service to stopped even if it returns bad on stop service."
 };
 
 /*
@@ -128,14 +128,14 @@
  * When we want to start a service, it is first SERVICE_START_MARKED
  */
 a_state_h SERVICE_START_MARKED = { "SERVICE_START_MARKED", IS_STARTING, NULL, &init_SERVICE_START_MARKED,
-    NULL
+	NULL
 };
 
 /*
  * When we want to stop a SERVICE_DONE service, its marked SERVICE_STOP_MARKED
  */
 a_state_h SERVICE_STOP_MARKED = { "SERVICE_STOP_MARKED", IS_STOPPING, NULL, &init_SERVICE_STOP_MARKED,
-    NULL
+	NULL
 };
 
 /*
@@ -147,28 +147,28 @@
  * When services needed by current one is starting, current service is set SERVICE_WAITING_FOR_START_DEP
  */
 a_state_h SERVICE_WAITING_FOR_START_DEP = { "SERVICE_WAITING_FOR_START_DEP", IS_STARTING,
-    &handle_SERVICE_WAITING_FOR_START_DEP, NULL, NULL
+	&handle_SERVICE_WAITING_FOR_START_DEP, NULL, NULL
 };
 
 /*
  * When services needed to stop, before this is stopped is stopping, current service is set SERVICE_WAITING_FOR_STOP_DEP
  */
 a_state_h SERVICE_WAITING_FOR_STOP_DEP = { "SERVICE_WAITING_FOR_STOP_DEP", IS_STOPPING,
-    &handle_SERVICE_WAITING_FOR_STOP_DEP, NULL, NULL
+	&handle_SERVICE_WAITING_FOR_STOP_DEP, NULL, NULL
 };
 
 /*
  * This state is set, when all services needed to start, is started.
  */
 a_state_h SERVICE_START_DEPS_MET = { "SERVICE_START_DEPS_MET", IS_STARTING, NULL,
-    &init_SERVICE_START_DEPS_MET, NULL
+	&init_SERVICE_START_DEPS_MET, NULL
 };
 
 /*
  * This state is set, when all services needed top be stopped, before stopping, is stopped.
  */
 a_state_h SERVICE_STOP_DEPS_MET = { "SERVICE_STOP_DEPS_MET", IS_STOPPING, NULL, &init_SERVICE_STOP_DEPS_MET,
-    NULL
+	NULL
 };
 
 /*
@@ -180,14 +180,14 @@
  * This is the state, when the Start code is actually running.
  */
 a_state_h SERVICE_START_RUN = { "SERVICE_START_RUN", IS_STARTING, NULL, &init_SERVICE_START_RUN,
-    &timeout_SERVICE_START_RUN
+	&timeout_SERVICE_START_RUN
 };
 
 /*
  * This is the state, when the Stop code is actually running.
  */
 a_state_h SERVICE_STOP_RUN = { "SERVICE_STOP_RUN", IS_STOPPING, NULL, &init_SERVICE_STOP_RUN,
-    &timeout_SERVICE_STOP_RUN
+	&timeout_SERVICE_STOP_RUN
 };
 
 /*
@@ -213,47 +213,47 @@
 static int start_SERVICE(active_db_h * service)
 {
 
-    /* if not stopped yet, reset DONE */
-    if (IS_MARK(service, &SERVICE_WAITING_FOR_STOP_DEP))
-    {
-	initng_common_mark_service(service, &SERVICE_DONE);
-	return (TRUE);
-    }
-
-    /* mark it WAITING_FOR_START_DEP and wait */
-    if (!initng_common_mark_service(service, &SERVICE_START_MARKED))
-    {
-	W_("mark_service SERVICE_START_MARKED failed for service %s\n",
-	   service->name);
-	return (FALSE);
-    }
+	/* if not stopped yet, reset DONE */
+	if (IS_MARK(service, &SERVICE_WAITING_FOR_STOP_DEP))
+	{
+		initng_common_mark_service(service, &SERVICE_DONE);
+		return (TRUE);
+	}
+
+	/* mark it WAITING_FOR_START_DEP and wait */
+	if (!initng_common_mark_service(service, &SERVICE_START_MARKED))
+	{
+		W_("mark_service SERVICE_START_MARKED failed for service %s\n",
+		   service->name);
+		return (FALSE);
+	}
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
 /* This are run, when initng wants to stop a service */
 static int stop_SERVICE(active_db_h * service)
 {
-    /* if not started yet, reset STOPPED */
-    if (IS_MARK(service, &SERVICE_WAITING_FOR_START_DEP))
-    {
-	initng_common_mark_service(service, &SERVICE_STOPPED);
-	return (TRUE);
-    }
-
+	/* if not started yet, reset STOPPED */
+	if (IS_MARK(service, &SERVICE_WAITING_FOR_START_DEP))
+	{
+		initng_common_mark_service(service, &SERVICE_STOPPED);
+		return (TRUE);
+	}
+
+
+	/* set stopping */
+	if (!initng_common_mark_service(service, &SERVICE_STOP_MARKED))
+	{
+		W_("mark_service SERVICE_STOP_MARKED failed for service %s.\n",
+		   service->name);
+		return (FALSE);
+	}
 
-    /* set stopping */
-    if (!initng_common_mark_service(service, &SERVICE_STOP_MARKED))
-    {
-	W_("mark_service SERVICE_STOP_MARKED failed for service %s.\n",
-	   service->name);
-	return (FALSE);
-    }
-
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 /*
@@ -265,78 +265,78 @@
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_types_add(&TYPE_SERVICE);
-
-    initng_process_db_ptype_add(&T_START);
-    initng_process_db_ptype_add(&T_STOP);
-
-    initng_active_state_add(&SERVICE_START_MARKED);
-    initng_active_state_add(&SERVICE_STOP_MARKED);
-    initng_active_state_add(&SERVICE_DONE);
-    initng_active_state_add(&SERVICE_WAITING_FOR_START_DEP);
-    initng_active_state_add(&SERVICE_WAITING_FOR_STOP_DEP);
-    initng_active_state_add(&SERVICE_START_DEPS_MET);
-    initng_active_state_add(&SERVICE_STOP_DEPS_MET);
-    initng_active_state_add(&SERVICE_STOPPED);
-    initng_active_state_add(&SERVICE_START_RUN);
-    initng_active_state_add(&SERVICE_STOP_RUN);
-    initng_active_state_add(&SERVICE_START_DEPS_FAILED);
-    initng_active_state_add(&SERVICE_STOP_DEPS_FAILED);
-    initng_active_state_add(&SERVICE_FAIL_STARTING);
-    initng_active_state_add(&SERVICE_FAIL_STOPPING);
-    initng_active_state_add(&SERVICE_START_FAILED_TIMEOUT);
-    initng_active_state_add(&SERVICE_STOP_FAILED_TIMEOUT);
-    initng_active_state_add(&SERVICE_UP_CHECK_FAILED);
-
-    initng_service_data_types_add(&START_TIMEOUT);
-    initng_service_data_types_add(&STOP_TIMEOUT);
-    initng_service_data_types_add(&NEVER_KILL);
-    initng_service_data_types_add(&START_FAIL_OK);
-    initng_service_data_types_add(&STOP_FAIL_OK);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_types_add(&TYPE_SERVICE);
+
+	initng_process_db_ptype_add(&T_START);
+	initng_process_db_ptype_add(&T_STOP);
+
+	initng_active_state_add(&SERVICE_START_MARKED);
+	initng_active_state_add(&SERVICE_STOP_MARKED);
+	initng_active_state_add(&SERVICE_DONE);
+	initng_active_state_add(&SERVICE_WAITING_FOR_START_DEP);
+	initng_active_state_add(&SERVICE_WAITING_FOR_STOP_DEP);
+	initng_active_state_add(&SERVICE_START_DEPS_MET);
+	initng_active_state_add(&SERVICE_STOP_DEPS_MET);
+	initng_active_state_add(&SERVICE_STOPPED);
+	initng_active_state_add(&SERVICE_START_RUN);
+	initng_active_state_add(&SERVICE_STOP_RUN);
+	initng_active_state_add(&SERVICE_START_DEPS_FAILED);
+	initng_active_state_add(&SERVICE_STOP_DEPS_FAILED);
+	initng_active_state_add(&SERVICE_FAIL_STARTING);
+	initng_active_state_add(&SERVICE_FAIL_STOPPING);
+	initng_active_state_add(&SERVICE_START_FAILED_TIMEOUT);
+	initng_active_state_add(&SERVICE_STOP_FAILED_TIMEOUT);
+	initng_active_state_add(&SERVICE_UP_CHECK_FAILED);
+
+	initng_service_data_types_add(&START_TIMEOUT);
+	initng_service_data_types_add(&STOP_TIMEOUT);
+	initng_service_data_types_add(&NEVER_KILL);
+	initng_service_data_types_add(&START_FAIL_OK);
+	initng_service_data_types_add(&STOP_FAIL_OK);
 
-    return (TRUE);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    initng_service_types_del(&TYPE_SERVICE);
+	initng_service_types_del(&TYPE_SERVICE);
 
-    initng_process_db_ptype_del(&T_START);
-    initng_process_db_ptype_del(&T_STOP);
+	initng_process_db_ptype_del(&T_START);
+	initng_process_db_ptype_del(&T_STOP);
 
 
-    initng_active_state_del(&SERVICE_START_MARKED);
-    initng_active_state_del(&SERVICE_STOP_MARKED);
-    initng_active_state_del(&SERVICE_DONE);
-    initng_active_state_del(&SERVICE_WAITING_FOR_START_DEP);
-    initng_active_state_del(&SERVICE_WAITING_FOR_STOP_DEP);
-    initng_active_state_del(&SERVICE_START_DEPS_MET);
-    initng_active_state_del(&SERVICE_STOP_DEPS_MET);
-    initng_active_state_del(&SERVICE_STOPPED);
-    initng_active_state_del(&SERVICE_START_RUN);
-    initng_active_state_del(&SERVICE_STOP_RUN);
-    initng_active_state_del(&SERVICE_START_DEPS_FAILED);
-    initng_active_state_del(&SERVICE_STOP_DEPS_FAILED);
-    initng_active_state_del(&SERVICE_FAIL_STARTING);
-    initng_active_state_del(&SERVICE_FAIL_STOPPING);
-    initng_active_state_del(&SERVICE_START_FAILED_TIMEOUT);
-    initng_active_state_del(&SERVICE_STOP_FAILED_TIMEOUT);
-    initng_active_state_del(&SERVICE_UP_CHECK_FAILED);
-
-    initng_service_data_types_del(&START_TIMEOUT);
-    initng_service_data_types_del(&STOP_TIMEOUT);
-    initng_service_data_types_del(&NEVER_KILL);
-    initng_service_data_types_del(&START_FAIL_OK);
-    initng_service_data_types_del(&STOP_FAIL_OK);
+	initng_active_state_del(&SERVICE_START_MARKED);
+	initng_active_state_del(&SERVICE_STOP_MARKED);
+	initng_active_state_del(&SERVICE_DONE);
+	initng_active_state_del(&SERVICE_WAITING_FOR_START_DEP);
+	initng_active_state_del(&SERVICE_WAITING_FOR_STOP_DEP);
+	initng_active_state_del(&SERVICE_START_DEPS_MET);
+	initng_active_state_del(&SERVICE_STOP_DEPS_MET);
+	initng_active_state_del(&SERVICE_STOPPED);
+	initng_active_state_del(&SERVICE_START_RUN);
+	initng_active_state_del(&SERVICE_STOP_RUN);
+	initng_active_state_del(&SERVICE_START_DEPS_FAILED);
+	initng_active_state_del(&SERVICE_STOP_DEPS_FAILED);
+	initng_active_state_del(&SERVICE_FAIL_STARTING);
+	initng_active_state_del(&SERVICE_FAIL_STOPPING);
+	initng_active_state_del(&SERVICE_START_FAILED_TIMEOUT);
+	initng_active_state_del(&SERVICE_STOP_FAILED_TIMEOUT);
+	initng_active_state_del(&SERVICE_UP_CHECK_FAILED);
+
+	initng_service_data_types_del(&START_TIMEOUT);
+	initng_service_data_types_del(&STOP_TIMEOUT);
+	initng_service_data_types_del(&NEVER_KILL);
+	initng_service_data_types_del(&START_FAIL_OK);
+	initng_service_data_types_del(&STOP_FAIL_OK);
 
 }
 
@@ -352,15 +352,15 @@
  */
 static void init_SERVICE_START_MARKED(active_db_h * service)
 {
-    /* Start our dependencies */
-    if (initng_depend_start_deps(service) != TRUE)
-    {
-	initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
-	return;
-    }
+	/* Start our dependencies */
+	if (initng_depend_start_deps(service) != TRUE)
+	{
+		initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
+		return;
+	}
 
-    /* set WAITING_FOR_START_DEP */
-    initng_common_mark_service(service, &SERVICE_WAITING_FOR_START_DEP);
+	/* set WAITING_FOR_START_DEP */
+	initng_common_mark_service(service, &SERVICE_WAITING_FOR_START_DEP);
 }
 
 /*
@@ -368,106 +368,106 @@
  */
 static void init_SERVICE_STOP_MARKED(active_db_h * service)
 {
-    /* Stopp all services dependeing on this service */
-    if (initng_depend_stop_deps(service) != TRUE)
-    {
-	initng_common_mark_service(service, &SERVICE_FAIL_STOPPING);
-	return;
-    }
+	/* Stopp all services dependeing on this service */
+	if (initng_depend_stop_deps(service) != TRUE)
+	{
+		initng_common_mark_service(service, &SERVICE_FAIL_STOPPING);
+		return;
+	}
 
-    initng_common_mark_service(service, &SERVICE_WAITING_FOR_STOP_DEP);
+	initng_common_mark_service(service, &SERVICE_WAITING_FOR_STOP_DEP);
 }
 
 static void handle_SERVICE_WAITING_FOR_START_DEP(active_db_h * service)
 {
-    assert(service);
+	assert(service);
 
-    /*
-     * this checks depencncy.
-     * initng_depend_start_dep_met() will return:
-     * TRUE (dep is met)
-     * FALSE (dep is not met)
-     * FAIL (dep is failed)
-     */
-    switch (initng_depend_start_dep_met(service, FALSE))
-    {
-	case TRUE:
-	    break;
-	case FAIL:
-	    initng_common_mark_service(service, &SERVICE_START_DEPS_FAILED);
-	    return;
-	default:
-	    /* return and hope that this handler will be called again. */
-	    return;
-    }
-
-    /* if system is shutting down, don't start anything */
-    if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
-    {
-	D_("Can't start service, when system status is: %i !\n", g.sys_state);
-	initng_common_mark_service(service, &SERVICE_STOPPED);
-	return;
-    }
+	/*
+	 * this checks depencncy.
+	 * initng_depend_start_dep_met() will return:
+	 * TRUE (dep is met)
+	 * FALSE (dep is not met)
+	 * FAIL (dep is failed)
+	 */
+	switch (initng_depend_start_dep_met(service, FALSE))
+	{
+		case TRUE:
+			break;
+		case FAIL:
+			initng_common_mark_service(service, &SERVICE_START_DEPS_FAILED);
+			return;
+		default:
+			/* return and hope that this handler will be called again. */
+			return;
+	}
+
+	/* if system is shutting down, don't start anything */
+	if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
+	{
+		D_("Can't start service, when system status is: %i !\n", g.sys_state);
+		initng_common_mark_service(service, &SERVICE_STOPPED);
+		return;
+	}
 
-    /* set status to START_DEP_MET */
-    initng_common_mark_service(service, &SERVICE_START_DEPS_MET);
+	/* set status to START_DEP_MET */
+	initng_common_mark_service(service, &SERVICE_START_DEPS_MET);
 
 }
 
 static void handle_SERVICE_WAITING_FOR_STOP_DEP(active_db_h * service)
 {
-    assert(service);
+	assert(service);
 
-    /* check with other plug-ins, if it is ok to stop this service now */
-    if (initng_depend_stop_dep_met(service, FALSE) != TRUE)
-	return;
+	/* check with other plug-ins, if it is ok to stop this service now */
+	if (initng_depend_stop_dep_met(service, FALSE) != TRUE)
+		return;
 
-    /* ok, stopping deps are met */
-    initng_common_mark_service(service, &SERVICE_STOP_DEPS_MET);
+	/* ok, stopping deps are met */
+	initng_common_mark_service(service, &SERVICE_STOP_DEPS_MET);
 }
 
 static void init_SERVICE_START_DEPS_MET(active_db_h * service)
 {
-    if (!initng_common_mark_service(service, &SERVICE_START_RUN))
-	return;
+	if (!initng_common_mark_service(service, &SERVICE_START_RUN))
+		return;
 
-    /* F I N A L L Y   S T A R T */
-    switch (initng_execute_launch(service, &T_START))
-    {
-	case FALSE:
-	    F_("Did not find a start entry to run!\n", service->name);
-	    initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
-	    return;
-	case FAIL:
-	    F_("Service %s, could not launch start, did not find any to launch!\n", service->name);
-	    initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
-	    return;
-	default:
-	    return;
-    }
+	/* F I N A L L Y   S T A R T */
+	switch (initng_execute_launch(service, &T_START))
+	{
+		case FALSE:
+			F_("Did not find a start entry to run!\n", service->name);
+			initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
+			return;
+		case FAIL:
+			F_("Service %s, could not launch start, did not find any to launch!\n", service->name);
+			initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
+			return;
+		default:
+			return;
+	}
 
 }
 
 static void init_SERVICE_STOP_DEPS_MET(active_db_h * service)
 {
-    /* mark this service as STOPPING */
-    if (!initng_common_mark_service(service, &SERVICE_STOP_RUN))
-	return;
-
-    /* launch stop service */
-    switch (initng_execute_launch(service, &T_STOP))
-    {
-	case FAIL:
-	    F_("  --  (%s): fail launch stop!\n", service->name);
-	    initng_common_mark_service(service, &SERVICE_FAIL_STOPPING);
-	    return;
-	case FALSE:
-	    /* there exists no stop process */
-	    initng_common_mark_service(service, &SERVICE_STOPPED);
-	    return;
-	default:
-	    return;
-    }
+	/* mark this service as STOPPING */
+	if (!initng_common_mark_service(service, &SERVICE_STOP_RUN))
+		return;
+
+	/* launch stop service */
+	switch (initng_execute_launch(service, &T_STOP))
+	{
+		case FAIL:
+			F_("  --  (%s): fail launch stop!\n", service->name);
+			initng_common_mark_service(service, &SERVICE_FAIL_STOPPING);
+			return;
+		case FALSE:
+			/* there exists no stop process */
+			initng_common_mark_service(service, &SERVICE_STOPPED);
+			return;
+		default:
+			return;
+	}
 
 }
 
@@ -478,23 +478,23 @@
  */
 static void init_SERVICE_START_RUN(active_db_h * service)
 {
-    int timeout;
+	int timeout;
 
-    D_("Service %s, run init_SERVICE_START_RUN\n", service->name);
+	D_("Service %s, run init_SERVICE_START_RUN\n", service->name);
 
-    /* if NEVER_KILL is set, dont bother */
-    if (is(&NEVER_KILL, service))
-	return;
+	/* if NEVER_KILL is set, dont bother */
+	if (is(&NEVER_KILL, service))
+		return;
 
-    /* get the timeout */
-    timeout = get_int(&START_TIMEOUT, service);
+	/* get the timeout */
+	timeout = get_int(&START_TIMEOUT, service);
 
-    /* if not set, use the default one */
-    if (!timeout)
-	timeout = DEFAULT_START_TIMEOUT;
+	/* if not set, use the default one */
+	if (!timeout)
+		timeout = DEFAULT_START_TIMEOUT;
 
-    /* set state alarm */
-    initng_handler_set_alarm(service, timeout);
+	/* set state alarm */
+	initng_handler_set_alarm(service, timeout);
 }
 
 /*
@@ -504,82 +504,82 @@
  */
 static void init_SERVICE_STOP_RUN(active_db_h * service)
 {
-    int timeout;
+	int timeout;
 
-    D_("Service %s, run init_SERVICE_STOP_RUN\n", service->name);
+	D_("Service %s, run init_SERVICE_STOP_RUN\n", service->name);
 
-    /* if NEVER_KILL is set, dont bother */
-    if (is(&NEVER_KILL, service))
-	return;
+	/* if NEVER_KILL is set, dont bother */
+	if (is(&NEVER_KILL, service))
+		return;
 
-    /* get the timeout */
-    timeout = get_int(&STOP_TIMEOUT, service);
+	/* get the timeout */
+	timeout = get_int(&STOP_TIMEOUT, service);
 
-    /* if not set, use the default timeout */
-    if (!timeout)
-	timeout = DEFAULT_STOP_TIMEOUT;
+	/* if not set, use the default timeout */
+	if (!timeout)
+		timeout = DEFAULT_STOP_TIMEOUT;
 
-    /* set state alarm */
-    initng_handler_set_alarm(service, timeout);
+	/* set state alarm */
+	initng_handler_set_alarm(service, timeout);
 }
 
 
 static void timeout_SERVICE_START_RUN(active_db_h * service)
 {
-    process_h *process = NULL;
+	process_h *process = NULL;
 
-    W_("Timeout for start process, service %s.  Killing this process now.\n",
-       service->name);
+	W_("Timeout for start process, service %s.  Killing this process now.\n",
+	   service->name);
 
-    /* get the process */
-    if (!(process = initng_process_db_get(&T_START, service)))
-    {
-	F_("Did not find the T_START process!\n");
-	return;
-    }
-
-    /* if the process does not exist on the system anymore, run the killd handler. */
-    if (process->pid <= 0 || (kill(process->pid, 0) && errno == ESRCH))
-    {
-	W_("The start process have dissapeared from the system without notice, running start kill handler.\n");
-	handle_killed_start(service, process);
-	return;
-    }
+	/* get the process */
+	if (!(process = initng_process_db_get(&T_START, service)))
+	{
+		F_("Did not find the T_START process!\n");
+		return;
+	}
+
+	/* if the process does not exist on the system anymore, run the killd handler. */
+	if (process->pid <= 0 || (kill(process->pid, 0) && errno == ESRCH))
+	{
+		W_("The start process have dissapeared from the system without notice, running start kill handler.\n");
+		handle_killed_start(service, process);
+		return;
+	}
 
-    /* send the process the SIGKILL signal */
-    kill(process->pid, SIGKILL);
+	/* send the process the SIGKILL signal */
+	kill(process->pid, SIGKILL);
 
-    /* set service state, to a failure state */
-    initng_common_mark_service(service, &SERVICE_START_FAILED_TIMEOUT);
+	/* set service state, to a failure state */
+	initng_common_mark_service(service, &SERVICE_START_FAILED_TIMEOUT);
 }
 
 static void timeout_SERVICE_STOP_RUN(active_db_h * service)
 {
-    process_h *process = NULL;
+	process_h *process = NULL;
 
-    W_("Timeout for stop process, service %s.   Killing this process now.\n",
-       service->name);
+	W_("Timeout for stop process, service %s.   Killing this process now.\n",
+	   service->name);
 
-    /* get the process */
-    if (!(process = initng_process_db_get(&T_STOP, service)))
-    {
-	F_("Did not find the T_STOP process!\n");
-	return;
-    }
-
-    /* if the process does not exist on the system anymore, run the killd handler. */
-    if (process->pid <= 0 || (kill(process->pid, 0) && errno == ESRCH))
-    {
-	W_("The stop process have dissapeared from the system without notice, running stop kill handler.\n");
-	handle_killed_stop(service, process);
-	return;
-    }
+	/* get the process */
+	if (!(process = initng_process_db_get(&T_STOP, service)))
+	{
+		F_("Did not find the T_STOP process!\n");
+		return;
+	}
+
+	/* if the process does not exist on the system anymore, run the killd handler. */
+	if (process->pid <= 0 || (kill(process->pid, 0) && errno == ESRCH))
+	{
+		W_("The stop process have dissapeared from the system without notice, running stop kill handler.\n");
+		handle_killed_stop(service, process);
+		return;
+	}
 
-    /* send the process the SIGKILL signal */
-    kill(process->pid, SIGKILL);
+	/* send the process the SIGKILL signal */
+	kill(process->pid, SIGKILL);
 
-    /* set service state, to a failure state */
-    initng_common_mark_service(service, &SERVICE_STOP_FAILED_TIMEOUT);
+	/* set service state, to a failure state */
+	initng_common_mark_service(service, &SERVICE_STOP_FAILED_TIMEOUT);
 }
 
 
@@ -601,128 +601,128 @@
  */
 static void handle_killed_start(active_db_h * service, process_h * process)
 {
-    assert(service);
-    assert(service->name);
-    assert(service->current_state);
-    assert(service->current_state->state_name);
-    assert(process);
-
-    D_("handle_killed_start(%s): initial status: \"%s\".\n",
-       service->name, service->current_state->state_name);
-
-    /*
-     * If the return code (for example "exit 1", in a bash script)
-     * from the program, is bigger than 0, this commonly signalize
-     * that something got wrong, print this as an error msg on screen
-     */
-    if (process->r_code > 0)
-	F_(" start %s, Returned with exit %i.\n", service->name,
-	   process->r_code);
-
-    /*
-     * If this exited after a timeout, stay failed
-     */
-    if (IS_MARK(service, &SERVICE_START_FAILED_TIMEOUT))
-    {
-	list_del(&process->list);
-	initng_process_db_free(process);
-	return;
-    }
+	assert(service);
+	assert(service->name);
+	assert(service->current_state);
+	assert(service->current_state->state_name);
+	assert(process);
+
+	D_("handle_killed_start(%s): initial status: \"%s\".\n",
+	   service->name, service->current_state->state_name);
+
+	/*
+	 * If the return code (for example "exit 1", in a bash script)
+	 * from the program, is bigger than 0, this commonly signalize
+	 * that something got wrong, print this as an error msg on screen
+	 */
+	if (process->r_code > 0)
+		F_(" start %s, Returned with exit %i.\n", service->name,
+		   process->r_code);
+
+	/*
+	 * If this exited after a timeout, stay failed
+	 */
+	if (IS_MARK(service, &SERVICE_START_FAILED_TIMEOUT))
+	{
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
+
+	/*
+	 * If service is stopping, ignore this signal
+	 */
+	if (!IS_MARK(service, &SERVICE_START_RUN))
+	{
+		F_("Start exited!, and service is not marked starting!\n");
+		return;
+	}
+
+
+	/*
+	 * Make sure r_code don't signal error (can be override by UP_ON_FAILURE.
+	 */
+
+	/*   TODO              MAKE UP_ON_FAILURE more universal */
+	if (process->r_code && !is(&START_FAIL_OK, service))
+	{
+
+		initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
+
+	/* make the final up check */
+	if (initng_depend_up_check(service) != TRUE)
+	{
+		initng_common_mark_service(service, &SERVICE_UP_CHECK_FAILED);
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
 
-    /*
-     * If service is stopping, ignore this signal
-     */
-    if (!IS_MARK(service, &SERVICE_START_RUN))
-    {
-	F_("Start exited!, and service is not marked starting!\n");
-	return;
-    }
-
-
-    /*
-     * Make sure r_code don't signal error (can be override by UP_ON_FAILURE.
-     */
-
-    /*   TODO              MAKE UP_ON_FAILURE more universal */
-    if (process->r_code && !is(&START_FAIL_OK, service))
-    {
-
-	initng_common_mark_service(service, &SERVICE_FAIL_STARTING);
-	list_del(&process->list);
-	initng_process_db_free(process);
-	return;
-    }
+	/* OK! now service is DONE! */
+	initng_common_mark_service(service, &SERVICE_DONE);
 
-    /* make the final up check */
-    if (initng_depend_up_check(service) != TRUE)
-    {
-	initng_common_mark_service(service, &SERVICE_UP_CHECK_FAILED);
+	/* free the process struct, to spare memory */
 	list_del(&process->list);
 	initng_process_db_free(process);
-	return;
-    }
-
-    /* OK! now service is DONE! */
-    initng_common_mark_service(service, &SERVICE_DONE);
-
-    /* free the process struct, to spare memory */
-    list_del(&process->list);
-    initng_process_db_free(process);
 }
 
 
 /* to do when a stop action dies */
 static void handle_killed_stop(active_db_h * service, process_h * process)
 {
-    assert(service);
-    assert(service->name);
-    assert(service->current_state);
-    assert(service->current_state->state_name);
-    assert(process);
-
-    D_("(%s);\n", service->name);
-
-    /*
-     * If this exited after a timeout, stay failed
-     */
-    if (IS_MARK(service, &SERVICE_STOP_FAILED_TIMEOUT))
-    {
-	list_del(&process->list);
-	initng_process_db_free(process);
-	return;
-    }
+	assert(service);
+	assert(service->name);
+	assert(service->current_state);
+	assert(service->current_state->state_name);
+	assert(process);
+
+	D_("(%s);\n", service->name);
+
+	/*
+	 * If this exited after a timeout, stay failed
+	 */
+	if (IS_MARK(service, &SERVICE_STOP_FAILED_TIMEOUT))
+	{
+		list_del(&process->list);
+		initng_process_db_free(process);
+		return;
+	}
+
+	/* make sure its a STOP_RUN state */
+	if (!IS_MARK(service, &SERVICE_STOP_RUN))
+	{
+		F_("stop service died, but service is not status STOPPING!\n");
+		return;
+	}
+
+	/*
+	 * If the return code (for example "exit 1", in a bash script)
+	 * from the program, is bigger than 0, this commonly signalize
+	 * that something got wrong, print this as an error msg on screen
+	 */
+	if (process->r_code > 0 && !is(&STOP_FAIL_OK, service))
+	{
+		F_(" stop %s, Returned with exit %i.\n", service->name,
+		   process->r_code);
+
+		/* free stopped process data */
+		list_del(&process->list);
+		initng_process_db_free(process);
 
-    /* make sure its a STOP_RUN state */
-    if (!IS_MARK(service, &SERVICE_STOP_RUN))
-    {
-	F_("stop service died, but service is not status STOPPING!\n");
-	return;
-    }
-
-    /*
-     * If the return code (for example "exit 1", in a bash script)
-     * from the program, is bigger than 0, this commonly signalize
-     * that something got wrong, print this as an error msg on screen
-     */
-    if (process->r_code > 0 && !is(&STOP_FAIL_OK, service))
-    {
-	F_(" stop %s, Returned with exit %i.\n", service->name,
-	   process->r_code);
+		/* mark service stopped */
+		initng_common_mark_service(service, &SERVICE_FAIL_STOPPING);
+
+		return;
+	}
 
 	/* free stopped process data */
 	list_del(&process->list);
 	initng_process_db_free(process);
 
 	/* mark service stopped */
-	initng_common_mark_service(service, &SERVICE_FAIL_STOPPING);
-
-	return;
-    }
-
-    /* free stopped process data */
-    list_del(&process->list);
-    initng_process_db_free(process);
-
-    /* mark service stopped */
-    initng_common_mark_service(service, &SERVICE_STOPPED);
+	initng_common_mark_service(service, &SERVICE_STOPPED);
 }

Modified: initng/trunk/plugins/simple_launcher/initng_simple_launcher.c
==============================================================================
--- initng/trunk/plugins/simple_launcher/initng_simple_launcher.c	(original)
+++ initng/trunk/plugins/simple_launcher/initng_simple_launcher.c	Wed Apr  5 23:11:19 2006
@@ -20,12 +20,12 @@
 
 #include <initng.h>
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <unistd.h>			    /* execv() pipe() usleep() pause() chown() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdlib.h>			    /* free() exit() */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <unistd.h>							/* execv() pipe() usleep() pause() chown() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdlib.h>							/* free() exit() */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
@@ -47,14 +47,14 @@
 #include <initng_env_variable.h>
 
 s_entry EXEC = { "exec", VARIABLE_STRING, NULL,
-    "Contains the path and arguments to a file to exec."
+	"Contains the path and arguments to a file to exec."
 };
 
 s_entry EXECS = { "exec_path", VARIABLE_STRINGS, NULL,
-    "The path for one ore more executables."
+	"The path for one ore more executables."
 };
 s_entry EXEC_ARGS = { "exec_args", VARIABLE_STRING, NULL,
-    "The arguments for the executable."
+	"The arguments for the executable."
 };
 
 /*#ifdef DEBUG
@@ -83,341 +83,341 @@
 
 static char *expand_exec(char *exec)
 {
-    char *filename = NULL;
-    size_t exec_len = 0;
-    size_t path_c, i, len = 0;
-    char *PATH = NULL;
-    char **path_argv = NULL;
-    struct stat test;
-
-
-    if (!exec)
-	return NULL;
-
-    /* 11/20/2005 SaTaN0rX: preliminary support for searching the PATH
-     * only search the PATH if this is NOT already an absolute path
-     */
-
-    /* if path provided, just return */
-    if (exec[0] == '/')
-	return (NULL);
-
-    /* get exec string length to later use */
-    exec_len = strlen(exec);
-
-    D_("initng_s_launch: %s is not an absolute path, searching $PATH\n",
-       exec);
-
-    /* get the env-path variable */
-    PATH = getenv("PATH");
-
-    /* Make sure we got a path */
-    if (!PATH)
-    {
-	D_("No $PATH found, using default path\n");
-	PATH = i_strdup("/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
-    }
-    else
-    {
-	/* PATH will later be changed, so we have to use a duplicate */
-	PATH = i_strdup(PATH);
-    }
-
-    D_("PATH determined to be %s\n", PATH);
-
-    /* split path by ':' char */
-    path_argv = split_delim(PATH, ":", &path_c, 0);
-
-    /* walk the list of entries */
-    for (i = 0; path_argv[i]; i++)
-    {
-	/* get entry length */
-	len = strlen(path_argv[i]);
-
-	/* what does this do? */
-	filename = (char *) i_calloc(exec_len + len + 2, sizeof(char));
-	strcpy(filename, path_argv[i]);
-	if (filename[len - 1] != '/')
-	    strcat(filename, "/");
-	strcat(filename, exec);
-
-	/* check so that file exits, if exists leave this loop */
-	if ((stat(filename, &test) != -1)
-	    && (test.
-		st_mode & (S_IXOTH | S_IXGRP | S_IXUSR | S_ISVTX | S_ISGID |
-			   S_ISUID | S_IFREG)))
-	    break;
-
-	/* cleanup */
-	free(filename);
-	filename = NULL;
-    }
-
-    /* free */
-    free(PATH);
-    free(path_argv);
-    PATH = NULL;
-    path_argv = NULL;
-
-    /* make sure we got a filename to use */
-    if (!filename)
-	F_("No executable found\n");
+	char *filename = NULL;
+	size_t exec_len = 0;
+	size_t path_c, i, len = 0;
+	char *PATH = NULL;
+	char **path_argv = NULL;
+	struct stat test;
 
-    /* return the filename */
-    return filename;
+
+	if (!exec)
+		return NULL;
+
+	/* 11/20/2005 SaTaN0rX: preliminary support for searching the PATH
+	 * only search the PATH if this is NOT already an absolute path
+	 */
+
+	/* if path provided, just return */
+	if (exec[0] == '/')
+		return (NULL);
+
+	/* get exec string length to later use */
+	exec_len = strlen(exec);
+
+	D_("initng_s_launch: %s is not an absolute path, searching $PATH\n",
+	   exec);
+
+	/* get the env-path variable */
+	PATH = getenv("PATH");
+
+	/* Make sure we got a path */
+	if (!PATH)
+	{
+		D_("No $PATH found, using default path\n");
+		PATH = i_strdup("/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
+	}
+	else
+	{
+		/* PATH will later be changed, so we have to use a duplicate */
+		PATH = i_strdup(PATH);
+	}
+
+	D_("PATH determined to be %s\n", PATH);
+
+	/* split path by ':' char */
+	path_argv = split_delim(PATH, ":", &path_c, 0);
+
+	/* walk the list of entries */
+	for (i = 0; path_argv[i]; i++)
+	{
+		/* get entry length */
+		len = strlen(path_argv[i]);
+
+		/* what does this do? */
+		filename = (char *) i_calloc(exec_len + len + 2, sizeof(char));
+		strcpy(filename, path_argv[i]);
+		if (filename[len - 1] != '/')
+			strcat(filename, "/");
+		strcat(filename, exec);
+
+		/* check so that file exits, if exists leave this loop */
+		if ((stat(filename, &test) != -1)
+			&& (test.
+				st_mode & (S_IXOTH | S_IXGRP | S_IXUSR | S_ISVTX | S_ISGID |
+						   S_ISUID | S_IFREG)))
+			break;
+
+		/* cleanup */
+		free(filename);
+		filename = NULL;
+	}
+
+	/* free */
+	free(PATH);
+	free(path_argv);
+	PATH = NULL;
+	path_argv = NULL;
+
+	/* make sure we got a filename to use */
+	if (!filename)
+		F_("No executable found\n");
+
+	/* return the filename */
+	return filename;
 }
 
 static int simple_exec_fork(process_h * process_to_exec, active_db_h * s,
-			    size_t argc, char **argv)
+							size_t argc, char **argv)
 {
-    /* This is the real service kicker */
-    pid_t pid_fork;		/* pid got from fork() */
+	/* This is the real service kicker */
+	pid_t pid_fork;				/* pid got from fork() */
 
-    if ((pid_fork = initng_fork(s, process_to_exec)) == 0)
-    {
+	if ((pid_fork = initng_fork(s, process_to_exec)) == 0)
+	{
 
 #ifdef DEBUG
-	D_("FROM_FORK simple_exec(%i,%s, ...);\n", argc, argv[0]);
-	/*D_argv("simple_exec: ", argv); */
+		D_("FROM_FORK simple_exec(%i,%s, ...);\n", argc, argv[0]);
+		/*D_argv("simple_exec: ", argv); */
 #endif
 
-	/* FINALLY EXECUTE *//* execve replaces the running process */
-	execve(argv[0], argv, new_environ(s));
+		/* FINALLY EXECUTE *//* execve replaces the running process */
+		execve(argv[0], argv, new_environ(s));
 
-	/* Will never get here if execve succeeded */
-	F_("ERROR!\n");
-	F_("Can't execute source %s!\n", argv[0]);
+		/* Will never get here if execve succeeded */
+		F_("ERROR!\n");
+		F_("Can't execute source %s!\n", argv[0]);
 
-	_exit(1);
-    }
+		_exit(1);
+	}
 
-    /* save pid of fork */
-    D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
+	/* save pid of fork */
+	D_("FROM_FORK Forkstarted pid %i.\n", pid_fork);
 
-    if (pid_fork > 0)
-	return (TRUE);
+	if (pid_fork > 0)
+		return (TRUE);
 
-    process_to_exec->pid = 0;
-    return FALSE;
-    /* if to test want to lock this up until fork is done ...   waitpid(pid_fork,0,0); */
-}					    /* end fork_and_exec() */
+	process_to_exec->pid = 0;
+	return FALSE;
+	/* if to test want to lock this up until fork is done ...   waitpid(pid_fork,0,0); */
+}											/* end fork_and_exec() */
 
 
 static int simple_exec_try(char *exec, active_db_h * service,
-			   process_h * process)
+						   process_h * process)
 {
-    const char *exec_args_unfixed = NULL;
-    char **argv = NULL;
-    size_t argc = 0;
+	const char *exec_args_unfixed = NULL;
+	char **argv = NULL;
+	size_t argc = 0;
+
+	D_("exec: %s, service: %s, process: %s\n", exec, service->name,
+	   process->pt->name);
+
+	/* exec_args should be parsed at the moment, too */
+	exec_args_unfixed = get_string_var(&EXEC_ARGS,
+									   process->pt->name, service);
+	if (exec_args_unfixed)
+	{
+		char *exec_args = NULL;
 
-    D_("exec: %s, service: %s, process: %s\n", exec, service->name,
-       process->pt->name);
 
-    /* exec_args should be parsed at the moment, too */
-    exec_args_unfixed = get_string_var(&EXEC_ARGS,
-				       process->pt->name, service);
-    if (exec_args_unfixed)
-    {
-	char *exec_args = NULL;
+		/* get some fixed variables, with ${VARIABLES} fixed, be aware that this is a new malloc and needs to be free() */
+		exec_args = fix_variables(exec_args_unfixed, service);
+		if (!exec_args)
+		{
+			F_("Failed to fix_variables: \"%s\"\n", exec_args);
+			return (FALSE);
+		}
+
+		/* split the string, with entries to an array of strings */
+		argv = split_delim(exec_args, WHITESPACE, &argc, 1);
+
+		/* make sure it succeeded */
+		if (!argv || !argv[0])
+		{
+			F_("split_delim exec_args returns NULL.\n");
+			free(exec_args);
+			exec_args = NULL;
+			return (FALSE);
+		}
 
 
-	/* get some fixed variables, with ${VARIABLES} fixed, be aware that this is a new malloc and needs to be free() */
-	exec_args = fix_variables(exec_args_unfixed, service);
-	if (!exec_args)
-	{
-	    F_("Failed to fix_variables: \"%s\"\n", exec_args);
-	    return (FALSE);
 	}
-
-	/* split the string, with entries to an array of strings */
-	argv = split_delim(exec_args, WHITESPACE, &argc, 1);
-
-	/* make sure it succeeded */
-	if (!argv || !argv[0])
+	else
 	{
-	    F_("split_delim exec_args returns NULL.\n");
-	    free(exec_args);
-	    exec_args = NULL;
-	    return (FALSE);
+		/* we need a empty argv anyway */
+		argv = (char **) i_calloc(2, sizeof(char *));
+		argv[1] = NULL;
+		argc = 0;
 	}
 
+	argv[0] = exec;
 
-    }
-    else
-    {
-	/* we need a empty argv anyway */
-	argv = (char **) i_calloc(2, sizeof(char *));
-	argv[1] = NULL;
-	argc = 0;
-    }
-
-    argv[0] = exec;
-
-    return (simple_exec_fork(process, service, argc, argv));
+	return (simple_exec_fork(process, service, argc, argv));
 
 }
 
 static int simple_exec(active_db_h * service, process_h * process)
 {
-    const char *exec = NULL;
-    struct stat stat_struct;
-    s_data *itt = NULL;
-
-    D_("service: %s, process: %s\n", service->name, process->pt->name);
-
-    while ((exec =
-	    get_next_string_var(&EXECS, process->pt->name, service, &itt)))
-    {
-	int res = FALSE;
-	char *exec_fixed = NULL;
+	const char *exec = NULL;
+	struct stat stat_struct;
+	s_data *itt = NULL;
 
-	/* be aware that fix_variables() return is a malloc, and needs to be free */
-	exec_fixed = fix_variables(exec, service);
+	D_("service: %s, process: %s\n", service->name, process->pt->name);
 
-	if (!exec_fixed)
+	while ((exec =
+			get_next_string_var(&EXECS, process->pt->name, service, &itt)))
 	{
-	    F_("Unable to fix_variables!\n");
-	    return (FALSE);
-	}
+		int res = FALSE;
+		char *exec_fixed = NULL;
 
-	/* check if the file exist */
-	if (stat(exec_fixed, &stat_struct) != 0)
-	{
-	    D_(" note, %s exec_fixed does not exist. \n", exec_fixed);
-	    continue;
-	}
-
-	/* Try to execute that one */
-	res = simple_exec_try(exec_fixed, service, process);
+		/* be aware that fix_variables() return is a malloc, and needs to be free */
+		exec_fixed = fix_variables(exec, service);
 
-	/* cleanup */
-	free(exec_fixed);
-	exec_fixed = NULL;
+		if (!exec_fixed)
+		{
+			F_("Unable to fix_variables!\n");
+			return (FALSE);
+		}
+
+		/* check if the file exist */
+		if (stat(exec_fixed, &stat_struct) != 0)
+		{
+			D_(" note, %s exec_fixed does not exist. \n", exec_fixed);
+			continue;
+		}
+
+		/* Try to execute that one */
+		res = simple_exec_try(exec_fixed, service, process);
+
+		/* cleanup */
+		free(exec_fixed);
+		exec_fixed = NULL;
+
+		/* Return true if successfully */
+		if (res == TRUE)
+			return (TRUE);
 
-	/* Return true if successfully */
-	if (res == TRUE)
-	    return (TRUE);
-
-    }
+	}
 
-    return (FALSE);
+	return (FALSE);
 }
 
 static int simple_run(active_db_h * service, process_h * process)
 {
-    const char *exec = NULL;
-    char *exec_fixed = NULL;
-    char **argv = NULL;
-    size_t argc = 0;
-    int result = FALSE;
-    char *argv0 = NULL;
+	const char *exec = NULL;
+	char *exec_fixed = NULL;
+	char **argv = NULL;
+	size_t argc = 0;
+	int result = FALSE;
+	char *argv0 = NULL;
+
+	D_("service: %s process: %s.\n", service->name, process->pt->name);
+
+	exec = get_string_var(&EXEC, process->pt->name, service);
+	if (!exec)
+		return (FALSE);
 
-    D_("service: %s process: %s.\n", service->name, process->pt->name);
 
-    exec = get_string_var(&EXEC, process->pt->name, service);
-    if (!exec)
-	return (FALSE);
+	/* be aware that fix_variables() return is a malloc, and needs to be free */
+	exec_fixed = fix_variables(exec, service);
+	if (!exec_fixed)
+	{
+		F_("Unable to fix_variables!\n");
+		return (FALSE);
+	}
 
+	/* argv-entries are pointer to exec_t[x] */
+	argv = split_delim(exec_fixed, WHITESPACE, &argc, 0);
+
+	/* make sure we got something from the split */
+	if (!argv || !argv[0])
+	{
+		D_("split_delim on exec returns NULL.\n");
+		free(exec_fixed);
+		exec_fixed = NULL;
+		return (FALSE);
+	}
+
+	/* if it not contains a full path */
+	if (argv[0][0] != '/')
+	{
+		argv0 = expand_exec(argv[0]);
+		if (!argv0)
+		{
+			D_("%s was not found in search path.\n", argv[0]);
+			free(argv);
+			argv = NULL;
+			free(exec_fixed);
+			exec_fixed = NULL;
+			return (FALSE);
+		}
+		argv[0] = argv0;
+	}
 
-    /* be aware that fix_variables() return is a malloc, and needs to be free */
-    exec_fixed = fix_variables(exec, service);
-    if (!exec_fixed)
-    {
-	F_("Unable to fix_variables!\n");
-	return (FALSE);
-    }
 
-    /* argv-entries are pointer to exec_t[x] */
-    argv = split_delim(exec_fixed, WHITESPACE, &argc, 0);
+	/* try to execute, remember the result */
+	result = simple_exec_fork(process, service, argc, argv);
 
-    /* make sure we got something from the split */
-    if (!argv || !argv[0])
-    {
-	D_("split_delim on exec returns NULL.\n");
+	/* clean up */
+	free(argv);
+	argv = NULL;
 	free(exec_fixed);
 	exec_fixed = NULL;
-	return (FALSE);
-    }
-
-    /* if it not contains a full path */
-    if (argv[0][0] != '/')
-    {
-	argv0 = expand_exec(argv[0]);
-	if (!argv0)
-	{
-	    D_("%s was not found in search path.\n", argv[0]);
-	    free(argv);
-	    argv = NULL;
-	    free(exec_fixed);
-	    exec_fixed = NULL;
-	    return (FALSE);
-	}
-	argv[0] = argv0;
-    }
-
-
-    /* try to execute, remember the result */
-    result = simple_exec_fork(process, service, argc, argv);
-
-    /* clean up */
-    free(argv);
-    argv = NULL;
-    free(exec_fixed);
-    exec_fixed = NULL;
-    if (argv0)
-    {
-	free(argv0);
-	argv0 = NULL;
-    }
+	if (argv0)
+	{
+		free(argv0);
+		argv0 = NULL;
+	}
 
-    /* return result */
-    if (result == FAIL)
-	return (FALSE);
-    return (result);
+	/* return result */
+	if (result == FAIL)
+		return (FALSE);
+	return (result);
 }
 
 static int initng_s_launch(active_db_h * service, process_h * process)
 {
 
-    assert(service);
-    assert(service->name);
-    assert(process);
+	assert(service);
+	assert(service->name);
+	assert(process);
 
-    D_("service: %s, process: %s\n", service->name, process->pt->name);
+	D_("service: %s, process: %s\n", service->name, process->pt->name);
 
-    if (is_var(&EXECS, process->pt->name, service))
-	return (simple_exec(service, process));
+	if (is_var(&EXECS, process->pt->name, service))
+		return (simple_exec(service, process));
 
-    if (is_var(&EXEC, process->pt->name, service))
-	return (simple_run(service, process));
+	if (is_var(&EXEC, process->pt->name, service))
+		return (simple_run(service, process));
 
-    return (FALSE);
+	return (FALSE);
 }
 
 
 int module_init(int api_version)
 {
-    D_("initng_simple_plugin: module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("initng_simple_plugin: module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_plugin_hook_add(&g.LAUNCH, 40, &initng_s_launch);
-    initng_service_data_types_add(&EXEC);
-    initng_service_data_types_add(&EXECS);
-    initng_service_data_types_add(&EXEC_ARGS);
-    return (TRUE);
+	initng_plugin_hook_add(&g.LAUNCH, 40, &initng_s_launch);
+	initng_service_data_types_add(&EXEC);
+	initng_service_data_types_add(&EXECS);
+	initng_service_data_types_add(&EXEC_ARGS);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("initng_simple_plugin: module_unload();\n");
+	D_("initng_simple_plugin: module_unload();\n");
 
-    initng_service_data_types_del(&EXEC);
-    initng_service_data_types_del(&EXECS);
-    initng_service_data_types_del(&EXEC_ARGS);
-    initng_plugin_hook_del(&g.LAUNCH, &initng_s_launch);
+	initng_service_data_types_del(&EXEC);
+	initng_service_data_types_del(&EXECS);
+	initng_service_data_types_del(&EXEC_ARGS);
+	initng_plugin_hook_del(&g.LAUNCH, &initng_s_launch);
 
 }

Modified: initng/trunk/plugins/stcmd/initng_stcmd.c
==============================================================================
--- initng/trunk/plugins/stcmd/initng_stcmd.c	(original)
+++ initng/trunk/plugins/stcmd/initng_stcmd.c	Wed Apr  5 23:11:19 2006
@@ -73,184 +73,184 @@
 static int cmd_new_init(char *arg);
 
 s_command GET_PID_OF = { 'g', "get_pid_of", INT_COMMAND, ADVANCHED_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_get_pid_of}, "Get pid of service"
+	{(void *) &cmd_get_pid_of}, "Get pid of service"
 };
 s_command START_ON_NEW = { 'j', "restart_from", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_start_on_new},
-    "Stop all services, and start from"
+	REQUIRES_OPT,
+	{(void *) &cmd_start_on_new},
+	"Stop all services, and start from"
 };
 s_command FREE_SERVICE = { 'z', "zap", TRUE_OR_FALSE_COMMAND, STANDARD_COMMAND, USES_OPT,
-    {(void *) &cmd_free_service},
-    "Resets a failed service, so it can be restarted."
+	{(void *) &cmd_free_service},
+	"Resets a failed service, so it can be restarted."
 };
 s_command RESTART_SERVICE = { 'r', "restart", TRUE_OR_FALSE_COMMAND, STANDARD_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_restart},
-    "Restart service"
+	REQUIRES_OPT,
+	{(void *) &cmd_restart},
+	"Restart service"
 };
 
 s_command PRINT_UPTIME = { 't', "time", STRING_COMMAND, ADVANCHED_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_print_uptime},
-    "Print uptime"
+	{(void *) &cmd_print_uptime},
+	"Print uptime"
 };
 s_command SERVICE_RELOAD = { 'R', "reload_service", TRUE_OR_FALSE_COMMAND, STANDARD_COMMAND,
-    USES_OPT,
-    {(void *) &cmd_reload},
-    "Reload service data from disk ( reparse /etc/initng )"
+	USES_OPT,
+	{(void *) &cmd_reload},
+	"Reload service data from disk ( reparse /etc/initng )"
 };
 
 s_command POWEROFF_INITNG = { '0', "poweroff", TRUE_OR_FALSE_COMMAND, STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_initng_poweroff},
-    "Power off the computer"
+	{(void *) &cmd_initng_poweroff},
+	"Power off the computer"
 };
 s_command HALT_INITNG = { '1', "halt", TRUE_OR_FALSE_COMMAND, STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_initng_halt},
-    "Halt the computer"
+	{(void *) &cmd_initng_halt},
+	"Halt the computer"
 };
 s_command REBOOT_INITNG = { '6', "reboot", TRUE_OR_FALSE_COMMAND, STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_initng_reboot},
-    "Reboot the computer"
+	{(void *) &cmd_initng_reboot},
+	"Reboot the computer"
 };
 
 
 s_command PRINT_MODULES = { 'm', "print_plugins", STRING_COMMAND, ADVANCHED_COMMAND, NO_OPT,
-    {(void *) &cmd_print_modules},
-    "Print loaded plugins"
+	{(void *) &cmd_print_modules},
+	"Print loaded plugins"
 };
 
 s_command LOAD_MODULE = { 'o', "load_module", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_load_module},
-    "Load Module"
+	REQUIRES_OPT,
+	{(void *) &cmd_load_module},
+	"Load Module"
 };
 s_command UNLOAD_MODULE = { 'w', "unload_module", TRUE_OR_FALSE_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_unload_module},
-    "UnLoad Module"
+	REQUIRES_OPT,
+	{(void *) &cmd_unload_module},
+	"UnLoad Module"
 };
 
 s_command PERCENT_DONE = { 'n', "done", INT_COMMAND, ADVANCHED_COMMAND, NO_OPT,
-    {(void *) &cmd_percent_done},
-    "Prints percent of system up"
+	{(void *) &cmd_percent_done},
+	"Prints percent of system up"
 };
 
 s_command GET_FATHER_OF = { 'f', "father", STRING_COMMAND, ADVANCHED_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_get_father_of},
-    "Print father to"
+	{(void *) &cmd_get_father_of},
+	"Print father to"
 };
 
 s_command DEPENDS_ON = { 'a', "service_dep_on", STRING_COMMAND, ADVANCHED_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_get_depends_on},
-    "Print what services me depends on"
+	{(void *) &cmd_get_depends_on},
+	"Print what services me depends on"
 };
 
 s_command DEPENDS_ON_DEEP = { 'A', "service_dep_on_deep", STRING_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_get_depends_on_deep},
-    "Print what services me depends on deep"
+	REQUIRES_OPT,
+	{(void *) &cmd_get_depends_on_deep},
+	"Print what services me depends on deep"
 };
 
 s_command DEPENDS_OFF = { 'b', "service_dep_on_me", STRING_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_get_depends_off},
-    "Print what dependencies that are depending on me"
+	REQUIRES_OPT,
+	{(void *) &cmd_get_depends_off},
+	"Print what dependencies that are depending on me"
 };
 
 s_command DEPENDS_OFF_DEEP = { 'B', "service_dep_on_me_deep", STRING_COMMAND, ADVANCHED_COMMAND,
-    REQUIRES_OPT,
-    {(void *) &cmd_get_depends_off_deep},
-    "Print what dependencies that are depending on me deep"
+	REQUIRES_OPT,
+	{(void *) &cmd_get_depends_off_deep},
+	"Print what dependencies that are depending on me deep"
 };
 
 
 s_command NEW_INIT = { 'E', "new_init", TRUE_OR_FALSE_COMMAND, HIDDEN_COMMAND, REQUIRES_OPT,
-    {(void *) &cmd_new_init},
-    "Stops all services, and when its done, launching a new init."
+	{(void *) &cmd_new_init},
+	"Stops all services, and when its done, launching a new init."
 };
 
 static int cmd_get_pid_of(char *arg)
 {
-    active_db_h *apt = NULL;
-    process_h *process = NULL;
+	active_db_h *apt = NULL;
+	process_h *process = NULL;
 
-    if (!arg)
-	return (-2);
+	if (!arg)
+		return (-2);
 
 
-    if (!(apt = initng_active_db_find_in_name(arg)))
-	return (-1);
+	if (!(apt = initng_active_db_find_in_name(arg)))
+		return (-1);
 
-    /* browse all processes */
-    while_processes(process, apt)
-    {
-	/* return the first process found */
-	return (process->pid);
-    }
+	/* browse all processes */
+	while_processes(process, apt)
+	{
+		/* return the first process found */
+		return (process->pid);
+	}
 
-    return (-3);
+	return (-3);
 }
 
 
 static int cmd_start_on_new(char *arg)
 {
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    g.when_out = THEN_RESTART;
-    initng_main_set_runlevel(arg);
-    initng_handler_stop_all();
-    return (TRUE);
+	g.when_out = THEN_RESTART;
+	initng_main_set_runlevel(arg);
+	initng_handler_stop_all();
+	return (TRUE);
 }
 
 static int cmd_free_service(char *arg)
 {
-    active_db_h *apt = NULL;
+	active_db_h *apt = NULL;
 
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    if (!(apt = initng_active_db_find_in_name(arg)))
-	return (FALSE);
+	if (!(apt = initng_active_db_find_in_name(arg)))
+		return (FALSE);
 
-    initng_active_db_del(apt);
-    initng_active_db_free(apt);
+	initng_active_db_del(apt);
+	initng_active_db_free(apt);
 
-    /* also flush file cache */
-    cmd_reload(arg);
+	/* also flush file cache */
+	cmd_reload(arg);
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 
 static int cmd_restart(char *arg)
 {
-    active_db_h *apt = NULL;
+	active_db_h *apt = NULL;
+
+	if (!arg)
+	{
+		F_("Must tell the service name to restart.\n");
+		return (FALSE);
+	}
+
+	apt = initng_active_db_find_in_name(arg);
+	if (!apt)
+	{
+		return (FALSE);
+		F_("Service \"%s\" not found.\n", arg);
+	}
 
-    if (!arg)
-    {
-	F_("Must tell the service name to restart.\n");
-	return (FALSE);
-    }
-
-    apt = initng_active_db_find_in_name(arg);
-    if (!apt)
-    {
-	return (FALSE);
-	F_("Service \"%s\" not found.\n", arg);
-    }
-
-    D_("removing service data for %s, to make sure .ii file is reloaded!\n",
-       arg);
-    if (apt->from_service)
-    {
-	list_del(&apt->from_service->list);
-	initng_service_cache_free(apt->from_service);
-    }
+	D_("removing service data for %s, to make sure .ii file is reloaded!\n",
+	   arg);
+	if (apt->from_service)
+	{
+		list_del(&apt->from_service->list);
+		initng_service_cache_free(apt->from_service);
+	}
 
-    D_("Restarting service %s\n", apt->name);
-    return (initng_handler_restart_service(apt));
+	D_("Restarting service %s\n", apt->name);
+	return (initng_handler_restart_service(apt));
 }
 
 
@@ -259,357 +259,357 @@
 
 static char *cmd_print_uptime(char *arg)
 {
-    active_db_h *apt = NULL;
-    struct timeval now;
-    char *string;
-
-    if (!arg)
-    {
-	return (i_strdup("Please tell me what service to get up-time from."));
-    }
-
-    apt = initng_active_db_find_in_name(arg);
-    if (!apt)
-    {
-	string = i_calloc(35 + strlen(arg), sizeof(char));
-	sprintf(string, "Service \"%s\" is not found!", arg);
-	return (string);
-    }
+	active_db_h *apt = NULL;
+	struct timeval now;
+	char *string;
 
-    gettimeofday(&now, NULL);
-    {
-	string = i_calloc(50, sizeof(char));
-	sprintf(string, "Up-time is %ims.\n",
-		MS_DIFF(now, apt->time_current_state));
-	return (string);
-    }
+	if (!arg)
+	{
+		return (i_strdup("Please tell me what service to get up-time from."));
+	}
+
+	apt = initng_active_db_find_in_name(arg);
+	if (!apt)
+	{
+		string = i_calloc(35 + strlen(arg), sizeof(char));
+		sprintf(string, "Service \"%s\" is not found!", arg);
+		return (string);
+	}
+
+	gettimeofday(&now, NULL);
+	{
+		string = i_calloc(50, sizeof(char));
+		sprintf(string, "Up-time is %ims.\n",
+				MS_DIFF(now, apt->time_current_state));
+		return (string);
+	}
 }
 
 
 static int cmd_reload(char *arg)
 {
-    service_cache_h *s;
+	service_cache_h *s;
 
-    /* if no arg, or empty arg set, remove all content */
-    if (!arg || strlen(arg) < 2)
-    {
-	D_("Clearing complete db.\n");
-	initng_service_cache_free_all();
-	return (TRUE);
-    }
+	/* if no arg, or empty arg set, remove all content */
+	if (!arg || strlen(arg) < 2)
+	{
+		D_("Clearing complete db.\n");
+		initng_service_cache_free_all();
+		return (TRUE);
+	}
 
-    s = initng_service_cache_find_in_name(arg);
-    if (!s)
-    {
-	D_("Did not find service %s to release cache for!\n", arg);
-	return (FALSE);
-    }
-
-    D_("removing service data for %s!\n", arg);
-    list_del(&s->list);
-    initng_service_cache_free(s);
-    return (TRUE);
+	s = initng_service_cache_find_in_name(arg);
+	if (!s)
+	{
+		D_("Did not find service %s to release cache for!\n", arg);
+		return (FALSE);
+	}
+
+	D_("removing service data for %s!\n", arg);
+	list_del(&s->list);
+	initng_service_cache_free(s);
+	return (TRUE);
 }
 
 static int cmd_initng_reboot(char *arg)
 {
-    (void) arg;
-    g.when_out = THEN_REBOOT;
-    initng_handler_stop_all();
-    return (TRUE);
+	(void) arg;
+	g.when_out = THEN_REBOOT;
+	initng_handler_stop_all();
+	return (TRUE);
 }
 
 static int cmd_initng_halt(char *arg)
 {
-    (void) arg;
-    g.when_out = THEN_HALT;
-    initng_handler_stop_all();
-    return (TRUE);
+	(void) arg;
+	g.when_out = THEN_HALT;
+	initng_handler_stop_all();
+	return (TRUE);
 }
 
 static int cmd_initng_poweroff(char *arg)
 {
-    (void) arg;
-    g.when_out = THEN_POWEROFF;
-    initng_handler_stop_all();
-    return (TRUE);
+	(void) arg;
+	g.when_out = THEN_POWEROFF;
+	initng_handler_stop_all();
+	return (TRUE);
 }
 
 static char *cmd_print_modules(char *arg)
 {
-    m_h *mod = NULL;
-    size_t string_len = 20;
-    char *string = i_calloc(string_len, sizeof(char));
-
-    (void) arg;
-
-
-    sprintf(string, "modules: \n");
-
-    while_module_db(mod)
-    {
-	/* Increase buffer for adding */
-	string_len += strlen(mod->module_name) + 8;
-	string = i_realloc(string, string_len * sizeof(char));
-	strcat(string, "  * ");
-	strcat(string, mod->module_name);
-	strcat(string, "\n");
-    }
+	m_h *mod = NULL;
+	size_t string_len = 20;
+	char *string = i_calloc(string_len, sizeof(char));
+
+	(void) arg;
+
 
-    return (string);
+	sprintf(string, "modules: \n");
+
+	while_module_db(mod)
+	{
+		/* Increase buffer for adding */
+		string_len += strlen(mod->module_name) + 8;
+		string = i_realloc(string, string_len * sizeof(char));
+		strcat(string, "  * ");
+		strcat(string, mod->module_name);
+		strcat(string, "\n");
+	}
+
+	return (string);
 }
 
 static int cmd_load_module(char *arg)
 {
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    /* load the module */
-    if (initng_load_module(arg) == NULL)
-	return (FALSE);
+	/* load the module */
+	if (initng_load_module(arg) == NULL)
+		return (FALSE);
 
-    /* clear the service cache, so new variables will be read next time */
-    initng_service_cache_free_all();
+	/* clear the service cache, so new variables will be read next time */
+	initng_service_cache_free_all();
 
-    return (TRUE);
+	return (TRUE);
 }
 
 static int cmd_unload_module(char *arg)
 {
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    /* Just to make sure. */
-    initng_service_cache_free_all();
+	/* Just to make sure. */
+	initng_service_cache_free_all();
 
-    return (initng_unload_module_named(arg));
+	return (initng_unload_module_named(arg));
 }
 
 static int cmd_percent_done(char *arg)
 {
-    (void) arg;
+	(void) arg;
 
-    return (initng_active_db_percent_started());
+	return (initng_active_db_percent_started());
 }
 
 
 
 static char *cmd_get_father_of(char *arg)
 {
-    char *string = NULL;
-    service_cache_h *s;
+	char *string = NULL;
+	service_cache_h *s;
+
+	s = initng_service_cache_find_in_name(arg);
+	if (!s)
+	{
+		return (i_strdup("Can't find service."));
+	}
 
-    s = initng_service_cache_find_in_name(arg);
-    if (!s)
-    {
-	return (i_strdup("Can't find service."));
-    }
-
-    if (s->father_name)
-	mprintf(&string, "Father to service %s is %s\n", s->name,
-		s->father_name);
-    else
-	mprintf(&string, "Service %s has no father\n", s->name);
+	if (s->father_name)
+		mprintf(&string, "Father to service %s is %s\n", s->name,
+				s->father_name);
+	else
+		mprintf(&string, "Service %s has no father\n", s->name);
 
-    return (string);
+	return (string);
 }
 
 
 static char *cmd_get_depends_on(char *arg)
 {
-    char *string = NULL;
-    active_db_h *current = NULL;
-    active_db_h *on = NULL;
-
-    on = initng_active_db_find_in_name(arg);
-
-    if (!on)
-	return (i_strdup("Did not find service."));
-
-    mprintf(&string, "The \"%s\" depends on:\n", on->name);
-
-    while_active_db(current)
-    {
-	/* if that we are watching needs current */
-	if (initng_depend(on, current) == TRUE)
-	{
-	    if (current->current_state && current->current_state->state_name)
-	    {
-		mprintf(&string, "  %s\t\t[%s]\n", current->name,
-			current->current_state->state_name);
-	    }
+	char *string = NULL;
+	active_db_h *current = NULL;
+	active_db_h *on = NULL;
+
+	on = initng_active_db_find_in_name(arg);
+
+	if (!on)
+		return (i_strdup("Did not find service."));
+
+	mprintf(&string, "The \"%s\" depends on:\n", on->name);
+
+	while_active_db(current)
+	{
+		/* if that we are watching needs current */
+		if (initng_depend(on, current) == TRUE)
+		{
+			if (current->current_state && current->current_state->state_name)
+			{
+				mprintf(&string, "  %s\t\t[%s]\n", current->name,
+						current->current_state->state_name);
+			}
+		}
 	}
-    }
-    return (string);
+	return (string);
 }
 
 static char *cmd_get_depends_on_deep(char *arg)
 {
-    char *string = NULL;
-    active_db_h *current = NULL;
-    active_db_h *on = NULL;
-
-    on = initng_active_db_find_in_name(arg);
-
-    if (!on)
-	return (i_strdup("Did not find service."));
-
-    mprintf(&string, "The \"%s\" depends on:\n", on->name);
-
-    while_active_db(current)
-    {
-	/* if that we are watching needs current */
-	if (initng_depend_deep(on, current) == TRUE)
-	{
-	    if (current->current_state && current->current_state->state_name)
-	    {
-		mprintf(&string, "  %s\t\t[%s]\n", current->name,
-			current->current_state->state_name);
-	    }
+	char *string = NULL;
+	active_db_h *current = NULL;
+	active_db_h *on = NULL;
+
+	on = initng_active_db_find_in_name(arg);
+
+	if (!on)
+		return (i_strdup("Did not find service."));
+
+	mprintf(&string, "The \"%s\" depends on:\n", on->name);
+
+	while_active_db(current)
+	{
+		/* if that we are watching needs current */
+		if (initng_depend_deep(on, current) == TRUE)
+		{
+			if (current->current_state && current->current_state->state_name)
+			{
+				mprintf(&string, "  %s\t\t[%s]\n", current->name,
+						current->current_state->state_name);
+			}
+		}
 	}
-    }
-    return (string);
+	return (string);
 }
 
 static char *cmd_get_depends_off(char *arg)
 {
-    char *string = NULL;
-    active_db_h *current = NULL;
-    active_db_h *on = NULL;
-
-    on = initng_active_db_find_in_name(arg);
-    if (!on)
-	return (i_strdup("Did not find service."));
-
-    mprintf(&string, "The services that depends on \"%s\":\n", on->name);
-
-    while_active_db(current)
-    {
-	/* if current need the one we are watching */
-	if (initng_depend(current, on) == TRUE)
-	{
-	    if (current->current_state && current->current_state->state_name)
-	    {
-		mprintf(&string, "  %s\t\t[%s]\n", current->name,
-			current->current_state->state_name);
-	    }
+	char *string = NULL;
+	active_db_h *current = NULL;
+	active_db_h *on = NULL;
+
+	on = initng_active_db_find_in_name(arg);
+	if (!on)
+		return (i_strdup("Did not find service."));
+
+	mprintf(&string, "The services that depends on \"%s\":\n", on->name);
+
+	while_active_db(current)
+	{
+		/* if current need the one we are watching */
+		if (initng_depend(current, on) == TRUE)
+		{
+			if (current->current_state && current->current_state->state_name)
+			{
+				mprintf(&string, "  %s\t\t[%s]\n", current->name,
+						current->current_state->state_name);
+			}
+		}
 	}
-    }
-    return (string);
+	return (string);
 }
 
 static char *cmd_get_depends_off_deep(char *arg)
 {
-    char *string = NULL;
-    active_db_h *current = NULL;
-    active_db_h *on = NULL;
-
-    on = initng_active_db_find_in_name(arg);
-
-    if (!on)
-	return (i_strdup("Did not find service."));
-
-    mprintf(&string, "The the services that depends on \"%s\":\n", on->name);
-
-    while_active_db(current)
-    {
-	/* if current need the one we are watching */
-	if (initng_depend_deep(current, on) == TRUE)
-	{
-	    if (current->current_state && current->current_state->state_name)
-	    {
-		mprintf(&string, "  %s\t\t[%s]\n", current->name,
-			current->current_state->state_name);
-	    }
+	char *string = NULL;
+	active_db_h *current = NULL;
+	active_db_h *on = NULL;
+
+	on = initng_active_db_find_in_name(arg);
+
+	if (!on)
+		return (i_strdup("Did not find service."));
+
+	mprintf(&string, "The the services that depends on \"%s\":\n", on->name);
+
+	while_active_db(current)
+	{
+		/* if current need the one we are watching */
+		if (initng_depend_deep(current, on) == TRUE)
+		{
+			if (current->current_state && current->current_state->state_name)
+			{
+				mprintf(&string, "  %s\t\t[%s]\n", current->name,
+						current->current_state->state_name);
+			}
+		}
 	}
-    }
-    return (string);
+	return (string);
 }
 
 
 static int cmd_new_init(char *arg)
 {
-    char *new_i;
-    int i = 0;
+	char *new_i;
+	int i = 0;
 
-    if (!arg)
-	return (FALSE);
+	if (!arg)
+		return (FALSE);
 
-    new_i = strdup(arg);
-    g.new_init = split_n(new_i, &i, 0, 0);
-    g.when_out = THEN_NEW_INIT;
+	new_i = strdup(arg);
+	g.new_init = split_n(new_i, &i, 0, 0);
+	g.when_out = THEN_NEW_INIT;
 
-    initng_handler_stop_all();
-    return (TRUE);
+	initng_handler_stop_all();
+	return (TRUE);
 }
 
 
 
 int module_init(int api_version)
 {
-    D_("module_init(stcmd);\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_command_add(&GET_PID_OF);
-    initng_command_add(&START_ON_NEW);
-    initng_command_add(&FREE_SERVICE);
-    initng_command_add(&RESTART_SERVICE);
-    initng_command_add(&PRINT_UPTIME);
-    initng_command_add(&SERVICE_RELOAD);
-    if (g.i_am_init)
-    {
-	initng_command_add(&REBOOT_INITNG);
-	initng_command_add(&POWEROFF_INITNG);
-	initng_command_add(&HALT_INITNG);
-    }
-    initng_command_add(&PRINT_MODULES);
-    initng_command_add(&LOAD_MODULE);
-    initng_command_add(&UNLOAD_MODULE);
-    initng_command_add(&PERCENT_DONE);
-    initng_command_add(&GET_FATHER_OF);
-    initng_command_add(&DEPENDS_ON);
-    initng_command_add(&DEPENDS_ON_DEEP);
-    initng_command_add(&DEPENDS_OFF);
-    initng_command_add(&DEPENDS_OFF_DEEP);
-    initng_command_add(&NEW_INIT);
+	D_("module_init(stcmd);\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    D_("libstcmd.so.0.0 loaded!\n");
-    return (TRUE);
+	initng_command_add(&GET_PID_OF);
+	initng_command_add(&START_ON_NEW);
+	initng_command_add(&FREE_SERVICE);
+	initng_command_add(&RESTART_SERVICE);
+	initng_command_add(&PRINT_UPTIME);
+	initng_command_add(&SERVICE_RELOAD);
+	if (g.i_am_init)
+	{
+		initng_command_add(&REBOOT_INITNG);
+		initng_command_add(&POWEROFF_INITNG);
+		initng_command_add(&HALT_INITNG);
+	}
+	initng_command_add(&PRINT_MODULES);
+	initng_command_add(&LOAD_MODULE);
+	initng_command_add(&UNLOAD_MODULE);
+	initng_command_add(&PERCENT_DONE);
+	initng_command_add(&GET_FATHER_OF);
+	initng_command_add(&DEPENDS_ON);
+	initng_command_add(&DEPENDS_ON_DEEP);
+	initng_command_add(&DEPENDS_OFF);
+	initng_command_add(&DEPENDS_OFF_DEEP);
+	initng_command_add(&NEW_INIT);
+
+	D_("libstcmd.so.0.0 loaded!\n");
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    D_("module_unload(stcmd);\n");
+	D_("module_unload(stcmd);\n");
 
-    initng_command_del(&GET_PID_OF);
-    initng_command_del(&START_ON_NEW);
-    initng_command_del(&FREE_SERVICE);
-    initng_command_del(&RESTART_SERVICE);
-    initng_command_del(&PRINT_UPTIME);
-    initng_command_del(&SERVICE_RELOAD);
-    if (g.i_am_init)
-    {
-	initng_command_del(&REBOOT_INITNG);
-	initng_command_del(&POWEROFF_INITNG);
-	initng_command_del(&HALT_INITNG);
-    }
-    initng_command_del(&PRINT_MODULES);
-    initng_command_del(&LOAD_MODULE);
-    initng_command_del(&UNLOAD_MODULE);
-    initng_command_del(&PERCENT_DONE);
-    initng_command_del(&GET_FATHER_OF);
-    initng_command_del(&DEPENDS_ON);
-    initng_command_del(&DEPENDS_ON_DEEP);
-    initng_command_del(&DEPENDS_OFF);
-    initng_command_del(&DEPENDS_OFF_DEEP);
-    initng_command_del(&NEW_INIT);
+	initng_command_del(&GET_PID_OF);
+	initng_command_del(&START_ON_NEW);
+	initng_command_del(&FREE_SERVICE);
+	initng_command_del(&RESTART_SERVICE);
+	initng_command_del(&PRINT_UPTIME);
+	initng_command_del(&SERVICE_RELOAD);
+	if (g.i_am_init)
+	{
+		initng_command_del(&REBOOT_INITNG);
+		initng_command_del(&POWEROFF_INITNG);
+		initng_command_del(&HALT_INITNG);
+	}
+	initng_command_del(&PRINT_MODULES);
+	initng_command_del(&LOAD_MODULE);
+	initng_command_del(&UNLOAD_MODULE);
+	initng_command_del(&PERCENT_DONE);
+	initng_command_del(&GET_FATHER_OF);
+	initng_command_del(&DEPENDS_ON);
+	initng_command_del(&DEPENDS_ON_DEEP);
+	initng_command_del(&DEPENDS_OFF);
+	initng_command_del(&DEPENDS_OFF_DEEP);
+	initng_command_del(&NEW_INIT);
 
 
-    D_("libstcmd.so.0.0 unloaded!\n");
+	D_("libstcmd.so.0.0 unloaded!\n");
 
 }

Modified: initng/trunk/plugins/stdout/initng_stdout.c
==============================================================================
--- initng/trunk/plugins/stdout/initng_stdout.c	(original)
+++ initng/trunk/plugins/stdout/initng_stdout.c	Wed Apr  5 23:11:19 2006
@@ -22,7 +22,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
@@ -36,184 +36,184 @@
 #include <initng_env_variable.h>
 
 s_entry STDOUT = { "stdout", STRING, NULL,
-    "Open a file with this path, and direct service output here."
+	"Open a file with this path, and direct service output here."
 };
 s_entry STDERR = { "stderr", STRING, NULL,
-    "Open a file with this path, and direct service error output here."
+	"Open a file with this path, and direct service error output here."
 };
 s_entry STDALL = { "stdall", STRING, NULL,
-    "Open a file with this path, and direct service all output here."
+	"Open a file with this path, and direct service all output here."
 };
 s_entry STDIN = { "stdin", STRING, NULL,
-    "Open a file with this path, and direct service input here."
+	"Open a file with this path, and direct service input here."
 };
 
 
 
 static int setup_output(active_db_h * s, process_h * p
-			__attribute__ ((unused)))
+						__attribute__ ((unused)))
 {
 
-    /* string containing the filename of output */
-    const char *s_stdout = NULL;
-    const char *s_stderr = NULL;
-    const char *s_stdall = NULL;
-    const char *s_stdin = NULL;
-
-    /* string containing the variable parser output */
-    char *f_stdout = NULL;
-    char *f_stderr = NULL;
-    char *f_stdall = NULL;
-    char *f_stdin = NULL;
-
-    /* file descriptors */
-    int fd_stdout = -1;
-    int fd_stderr = -1;
-    int fd_stdall = -1;
-    int fd_stdin = -1;
-
-    /* assert some */
-    assert(s);
-    assert(s->name);
-    assert(p);
-
-    S_;
-
-    /* get strings if present */
-    s_stdout = get_string(&STDOUT, s);
-    s_stderr = get_string(&STDERR, s);
-    s_stdall = get_string(&STDALL, s);
-    s_stdin = get_string(&STDIN, s);
-
-    if (!(s_stdout || s_stderr || s_stdall || s_stdin))
-    {
-	D_("This plugin won't do anything, because no opt set!\n");
-	return (TRUE);
-    }
+	/* string containing the filename of output */
+	const char *s_stdout = NULL;
+	const char *s_stderr = NULL;
+	const char *s_stdall = NULL;
+	const char *s_stdin = NULL;
+
+	/* string containing the variable parser output */
+	char *f_stdout = NULL;
+	char *f_stderr = NULL;
+	char *f_stdall = NULL;
+	char *f_stdin = NULL;
+
+	/* file descriptors */
+	int fd_stdout = -1;
+	int fd_stderr = -1;
+	int fd_stdall = -1;
+	int fd_stdin = -1;
+
+	/* assert some */
+	assert(s);
+	assert(s->name);
+	assert(p);
+
+	S_;
+
+	/* get strings if present */
+	s_stdout = get_string(&STDOUT, s);
+	s_stderr = get_string(&STDERR, s);
+	s_stdall = get_string(&STDALL, s);
+	s_stdin = get_string(&STDIN, s);
+
+	if (!(s_stdout || s_stderr || s_stdall || s_stdin))
+	{
+		D_("This plugin won't do anything, because no opt set!\n");
+		return (TRUE);
+	}
+
+	/* if stdout points to same as stderr, set s_stdall */
+	if (s_stdout && s_stderr && strcmp(s_stdout, s_stderr) == 0)
+	{
+		s_stdall = s_stdout;
+		s_stdout = NULL;
+		s_stderr = NULL;
+	}
+
+
+	/* fix variables */
+	if (s_stdout)
+		f_stdout = fix_variables(s_stdout, s);
+	if (s_stderr)
+		f_stderr = fix_variables(s_stderr, s);
+	if (s_stdall)
+		f_stdall = fix_variables(s_stdall, s);
+	if (s_stdin)
+		f_stdin = fix_variables(s_stdin, s);
+
+
+	/* if stdall string is set */
+	if (f_stdall)
+	{
+		/* output all to this */
+		fd_stdall = open(f_stdall, O_WRONLY | O_NOCTTY | O_CREAT | O_APPEND,
+						 0644);
+	}
+	else
+	{
+		/* else set them to different files */
+		if (f_stdout)
+			fd_stdout = open(f_stdout,
+							 O_WRONLY | O_NOCTTY | O_CREAT | O_APPEND, 0644);
+		if (f_stderr)
+			fd_stderr = open(f_stderr,
+							 O_WRONLY | O_NOCTTY | O_CREAT | O_APPEND, 0644);
+	}
+	if (f_stdin)
+		fd_stdin = open(f_stdin, O_RDONLY | O_NOCTTY, 0644);
+
+	/* print fail messages, if the files did not open */
+	if (f_stdall && fd_stdall < 2)
+		F_("StdALL: %s, fd %i\n", f_stdall, fd_stdall);
+	if (f_stdout && fd_stdout < 2)
+		F_("StdOUT: %s, fd %i\n", f_stdout, fd_stdout);
+	if (f_stderr && fd_stderr < 2)
+		F_("StdERR: %s, fd %i\n", f_stderr, fd_stderr);
+	if (f_stdin && fd_stdin < 2)
+		F_("StdIN: %s, fd %i\n", f_stdin, fd_stdin);
 
-    /* if stdout points to same as stderr, set s_stdall */
-    if (s_stdout && s_stderr && strcmp(s_stdout, s_stderr) == 0)
-    {
-	s_stdall = s_stdout;
-	s_stdout = NULL;
-	s_stderr = NULL;
-    }
-
-
-    /* fix variables */
-    if (s_stdout)
-	f_stdout = fix_variables(s_stdout, s);
-    if (s_stderr)
-	f_stderr = fix_variables(s_stderr, s);
-    if (s_stdall)
-	f_stdall = fix_variables(s_stdall, s);
-    if (s_stdin)
-	f_stdin = fix_variables(s_stdin, s);
-
-
-    /* if stdall string is set */
-    if (f_stdall)
-    {
-	/* output all to this */
-	fd_stdall = open(f_stdall, O_WRONLY | O_NOCTTY | O_CREAT | O_APPEND,
-			 0644);
-    }
-    else
-    {
-	/* else set them to different files */
+#ifdef DEBUG
+	if (f_stdall)
+		D_("StdALL: %s, fd %i\n", f_stdall, fd_stdall);
 	if (f_stdout)
-	    fd_stdout = open(f_stdout,
-			     O_WRONLY | O_NOCTTY | O_CREAT | O_APPEND, 0644);
+		D_("StdOUT: %s, fd %i\n", f_stdout, fd_stdout);
 	if (f_stderr)
-	    fd_stderr = open(f_stderr,
-			     O_WRONLY | O_NOCTTY | O_CREAT | O_APPEND, 0644);
-    }
-    if (f_stdin)
-	fd_stdin = open(f_stdin, O_RDONLY | O_NOCTTY, 0644);
-
-    /* print fail messages, if the files did not open */
-    if (f_stdall && fd_stdall < 2)
-	F_("StdALL: %s, fd %i\n", f_stdall, fd_stdall);
-    if (f_stdout && fd_stdout < 2)
-	F_("StdOUT: %s, fd %i\n", f_stdout, fd_stdout);
-    if (f_stderr && fd_stderr < 2)
-	F_("StdERR: %s, fd %i\n", f_stderr, fd_stderr);
-    if (f_stdin && fd_stdin < 2)
-	F_("StdIN: %s, fd %i\n", f_stdin, fd_stdin);
-
-#ifdef DEBUG
-    if (f_stdall)
-	D_("StdALL: %s, fd %i\n", f_stdall, fd_stdall);
-    if (f_stdout)
-	D_("StdOUT: %s, fd %i\n", f_stdout, fd_stdout);
-    if (f_stderr)
-	D_("StdERR: %s, fd %i\n", f_stderr, fd_stderr);
-    if (f_stdin)
-	D_("StdIN:  %s, fd %i\n", f_stdin, fd_stdin);
+		D_("StdERR: %s, fd %i\n", f_stderr, fd_stderr);
+	if (f_stdin)
+		D_("StdIN:  %s, fd %i\n", f_stdin, fd_stdin);
 #endif
 
-    /* if fd succeeded to open */
-    if (fd_stdall > 2)
-    {
-	/* dup both to stdall */
-	dup2(fd_stdall, 1);
-	dup2(fd_stdall, 2);
-    }
-    else
-    {
-	/* else dup them to diffrent fds */
-	if (fd_stdout > 2)
-	    dup2(fd_stdout, 1);
-	if (fd_stderr > 2)
-	    dup2(fd_stderr, 2);
-    }
-    if (fd_stdin > 2)
-	dup2(fd_stdin, 0);
-
-    /* free the (by fix_variables) duped variables */
-    if (f_stdout)
-	free(f_stdout);
-    if (f_stderr)
-	free(f_stderr);
-    if (f_stdall)
-	free(f_stdall);
-    if (f_stdin)
-	free(f_stdin);
+	/* if fd succeeded to open */
+	if (fd_stdall > 2)
+	{
+		/* dup both to stdall */
+		dup2(fd_stdall, 1);
+		dup2(fd_stdall, 2);
+	}
+	else
+	{
+		/* else dup them to diffrent fds */
+		if (fd_stdout > 2)
+			dup2(fd_stdout, 1);
+		if (fd_stderr > 2)
+			dup2(fd_stderr, 2);
+	}
+	if (fd_stdin > 2)
+		dup2(fd_stdin, 0);
 
-    return (TRUE);
+	/* free the (by fix_variables) duped variables */
+	if (f_stdout)
+		free(f_stdout);
+	if (f_stderr)
+		free(f_stderr);
+	if (f_stdall)
+		free(f_stdall);
+	if (f_stdin)
+		free(f_stdin);
+
+	return (TRUE);
 }
 
 
 int module_init(int api_version)
 {
-    S_;
+	S_;
 
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&STDOUT);
-    initng_service_data_types_add(&STDERR);
-    initng_service_data_types_add(&STDALL);
-    initng_service_data_types_add(&STDIN);
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&STDOUT);
+	initng_service_data_types_add(&STDERR);
+	initng_service_data_types_add(&STDALL);
+	initng_service_data_types_add(&STDIN);
 
-    initng_plugin_hook_add(&g.A_FORK, 30, &setup_output);
-    return (TRUE);
+	initng_plugin_hook_add(&g.A_FORK, 30, &setup_output);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    S_;
+	S_;
 
-    D_("module_unload();\n");
+	D_("module_unload();\n");
 
-    initng_service_data_types_del(&STDOUT);
-    initng_service_data_types_del(&STDERR);
-    initng_service_data_types_del(&STDALL);
-    initng_service_data_types_del(&STDIN);
+	initng_service_data_types_del(&STDOUT);
+	initng_service_data_types_del(&STDERR);
+	initng_service_data_types_del(&STDALL);
+	initng_service_data_types_del(&STDIN);
 
-    initng_plugin_hook_del(&g.A_FORK, &setup_output);
+	initng_plugin_hook_del(&g.A_FORK, &setup_output);
 }

Modified: initng/trunk/plugins/suid/initng_suid.c
==============================================================================
--- initng/trunk/plugins/suid/initng_suid.c	(original)
+++ initng/trunk/plugins/suid/initng_suid.c	Wed Apr  5 23:11:19 2006
@@ -41,125 +41,125 @@
 void adjust_env(active_db_h * service, const char *vn, const char *vv);
 void adjust_env(active_db_h * service, const char *vn, const char *vv)
 {
-    /* add to service cache */
-    if (is_var(&ENV, vn, service->from_service))
-    {
-	return;				    /* Assume they were set by .i file, don't override */
-    }
-    else
-    {
-	set_string_var(&ENV, i_strdup(vn), service->from_service,
-		       i_strdup(vv));
-    }
+	/* add to service cache */
+	if (is_var(&ENV, vn, service->from_service))
+	{
+		return;								/* Assume they were set by .i file, don't override */
+	}
+	else
+	{
+		set_string_var(&ENV, i_strdup(vn), service->from_service,
+					   i_strdup(vv));
+	}
 }
 
 static int do_suid(active_db_h * service, process_h * process
-		   __attribute__ ((unused)))
+				   __attribute__ ((unused)))
 {
-    struct passwd *passwd = NULL;
-    struct group *group = NULL;
-    int ret = TRUE;
-    int i = 0;
-    int gid = 0;
-    int uid = 0;
-    const char *tmp = NULL;
-    char *groupname = NULL;
-    char *username = NULL;
-
-    assert(service);
-    assert(service->name);
-    assert(process);
-
-    if ((tmp = get_string(&SGID, service)))
-    {
-	groupname = fix_variables(tmp, service);
-    }
-
-    tmp = get_string(&SUID, service);
-    if (tmp)
-	username = fix_variables(tmp, service);
-
-    if (username && !groupname)
-    {
-	i = strcspn(username, ":");
-	if (username[i] == ':')
-	{
-	    groupname = strdup(username + i + 1);
-	    username[i] = 0;
-	}
-    }
-
-
-    if (groupname)
-	group = getgrnam(groupname);
-    if (username)
-	passwd = getpwnam(username);
-
-    if (passwd)
-    {
-	uid = passwd->pw_uid;
-	gid = passwd->pw_gid;
-    }
-    else if (username)
-    {
-	F_("USER \"%s\" not found!\n", username);
-	ret += 2;
-    }
-
-    if (group)
-	gid = group->gr_gid;
-    else if (groupname)
-    {
-	F_("GROUP \"%s\" not found!\n", groupname);
-	ret += 1;
-    }
-
-    if (gid)
-    {
-	D_("Change to gid %i", gid);
-	setgid(gid);
-    }
-
-    if (passwd)
-	initgroups(passwd->pw_name, passwd->pw_gid);
-
-    if (uid)
-    {
-	D_("Change to uid %i", uid);
-	setuid(uid);
-
-	/* Set UID-related env variables */
-	adjust_env(service, "USER", passwd->pw_name);
-	adjust_env(service, "HOME", passwd->pw_dir);
-	adjust_env(service, "PATH", "/bin:/usr/bin");
-    }
-
-    if (groupname)
-	free(groupname);
-    if (username)
-	free(username);
-    /* group and passwd are static data structures - don't free */
-    return ret;
+	struct passwd *passwd = NULL;
+	struct group *group = NULL;
+	int ret = TRUE;
+	int i = 0;
+	int gid = 0;
+	int uid = 0;
+	const char *tmp = NULL;
+	char *groupname = NULL;
+	char *username = NULL;
+
+	assert(service);
+	assert(service->name);
+	assert(process);
+
+	if ((tmp = get_string(&SGID, service)))
+	{
+		groupname = fix_variables(tmp, service);
+	}
+
+	tmp = get_string(&SUID, service);
+	if (tmp)
+		username = fix_variables(tmp, service);
+
+	if (username && !groupname)
+	{
+		i = strcspn(username, ":");
+		if (username[i] == ':')
+		{
+			groupname = strdup(username + i + 1);
+			username[i] = 0;
+		}
+	}
+
+
+	if (groupname)
+		group = getgrnam(groupname);
+	if (username)
+		passwd = getpwnam(username);
+
+	if (passwd)
+	{
+		uid = passwd->pw_uid;
+		gid = passwd->pw_gid;
+	}
+	else if (username)
+	{
+		F_("USER \"%s\" not found!\n", username);
+		ret += 2;
+	}
+
+	if (group)
+		gid = group->gr_gid;
+	else if (groupname)
+	{
+		F_("GROUP \"%s\" not found!\n", groupname);
+		ret += 1;
+	}
+
+	if (gid)
+	{
+		D_("Change to gid %i", gid);
+		setgid(gid);
+	}
+
+	if (passwd)
+		initgroups(passwd->pw_name, passwd->pw_gid);
+
+	if (uid)
+	{
+		D_("Change to uid %i", uid);
+		setuid(uid);
+
+		/* Set UID-related env variables */
+		adjust_env(service, "USER", passwd->pw_name);
+		adjust_env(service, "HOME", passwd->pw_dir);
+		adjust_env(service, "PATH", "/bin:/usr/bin");
+	}
+
+	if (groupname)
+		free(groupname);
+	if (username)
+		free(username);
+	/* group and passwd are static data structures - don't free */
+	return ret;
 }
 
 int module_init(int api_version)
 {
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&SUID);
-    initng_service_data_types_add(&SGID);
-    return (initng_plugin_hook_add(&g.A_FORK, 90, &do_suid));
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+
+	initng_service_data_types_add(&SUID);
+	initng_service_data_types_add(&SGID);
+	return (initng_plugin_hook_add(&g.A_FORK, 90, &do_suid));
 }
 
 void module_unload(void)
 {
-    D_("module_unload();\n");
-    initng_service_data_types_del(&SUID);
-    initng_service_data_types_del(&SGID);
-    initng_plugin_hook_del(&g.A_FORK, &do_suid);
+	D_("module_unload();\n");
+	initng_service_data_types_del(&SUID);
+	initng_service_data_types_del(&SGID);
+	initng_plugin_hook_del(&g.A_FORK, &do_suid);
 }

Modified: initng/trunk/plugins/syncron/initng_syncron.c
==============================================================================
--- initng/trunk/plugins/syncron/initng_syncron.c	(original)
+++ initng/trunk/plugins/syncron/initng_syncron.c	Wed Apr  5 23:11:19 2006
@@ -22,8 +22,8 @@
 
 
 #include <stdio.h>
-#include <string.h>			    /* strstr() */
-#include <stdlib.h>			    /* free() exit() */
+#include <string.h>							/* strstr() */
+#include <stdlib.h>							/* free() exit() */
 #include <assert.h>
 #include <initng_handler.h>
 #include <initng_global.h>
@@ -33,127 +33,127 @@
 #include <initng_static_states.h>
 
 s_entry SYNCRON = { "syncron", STRING, NULL,
-    "All services with this same syncron string, can't be started asynchronous."
+	"All services with this same syncron string, can't be started asynchronous."
 };
 a_state_h *SERVICE_START_RUN;
 static int check;
 
 static int resolv_SSR(void)
 {
-    SERVICE_START_RUN = initng_active_state_find("SERVICE_START_RUN");
-    if (!SERVICE_START_RUN)
-    {
-	F_("Could not resolve SERVICE_START_RUN, is service type loaded?");
-	return (FALSE);
+	SERVICE_START_RUN = initng_active_state_find("SERVICE_START_RUN");
+	if (!SERVICE_START_RUN)
+	{
+		F_("Could not resolve SERVICE_START_RUN, is service type loaded?");
+		return (FALSE);
 
-    }
-    return (TRUE);
+	}
+	return (TRUE);
 }
 
 
 /* Make sure if service syncron=module_loading, only one of the services with module_loading runs at once */
 static int check_syncronicly_service(active_db_h * service)
 {
-    active_db_h *current, *q = NULL;
-    const char *service_syncron;
-    const char *current_syncron;
+	active_db_h *current, *q = NULL;
+	const char *service_syncron;
+	const char *current_syncron;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* we must have this state resolve, to compare it */
-    if (!resolv_SSR())
-	return (TRUE);
+	/* we must have this state resolve, to compare it */
+	if (!resolv_SSR())
+		return (TRUE);
 
-    if ((service_syncron = get_string(&SYNCRON, service)) == NULL)
-	return (TRUE);
+	if ((service_syncron = get_string(&SYNCRON, service)) == NULL)
+		return (TRUE);
 
-    while_active_db_safe(current, q)
-    {
-	/* don't check ourself */
-	if (current == service)
+	while_active_db_safe(current, q)
 	{
-	    continue;
-	}
+		/* don't check ourself */
+		if (current == service)
+		{
+			continue;
+		}
 
-	/* If this service has the start process running */
-	if (IS_MARK(current, SERVICE_START_RUN))
-	{
-	    if ((current_syncron = get_string(&SYNCRON, current)) != NULL)
-	    {
-		if (strcmp(service_syncron, current_syncron) == 0)
+		/* If this service has the start process running */
+		if (IS_MARK(current, SERVICE_START_RUN))
 		{
-		    D_("Service %s has to wait for %s\n", service->name,
-		       current->name);
-		    /* refuse to change status */
-		    return (FALSE);
+			if ((current_syncron = get_string(&SYNCRON, current)) != NULL)
+			{
+				if (strcmp(service_syncron, current_syncron) == 0)
+				{
+					D_("Service %s has to wait for %s\n", service->name,
+					   current->name);
+					/* refuse to change status */
+					return (FALSE);
+				}
+			}
 		}
-	    }
 	}
-    }
-    return (TRUE);
+	return (TRUE);
 }
 
 /* Make sure there is only one service starting */
 static int check_syncronicly(active_db_h * service)
 {
-    active_db_h *current, *q = NULL;
-
-    /* we must have this state resolve, to compare it */
-    if (!resolv_SSR())
-	return (TRUE);
+	active_db_h *current, *q = NULL;
 
-    while_active_db_safe(current, q)
-    {
-	/* don't check ourself */
-	if (current == service)
-	    continue;
+	/* we must have this state resolve, to compare it */
+	if (!resolv_SSR())
+		return (TRUE);
 
-	if (IS_MARK(service, SERVICE_START_RUN))
+	while_active_db_safe(current, q)
 	{
-	    /* no i cant set this status yet */
-	    return (FALSE);
+		/* don't check ourself */
+		if (current == service)
+			continue;
+
+		if (IS_MARK(service, SERVICE_START_RUN))
+		{
+			/* no i cant set this status yet */
+			return (FALSE);
+		}
 	}
-    }
-    return (TRUE);
+	return (TRUE);
 }
 
 int module_init(int api_version)
 {
-    int i;
+	int i;
 
-    SERVICE_START_RUN = NULL;
+	SERVICE_START_RUN = NULL;
 
-    D_("module_init();\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-
-    initng_service_data_types_add(&SYNCRON);
-    for (i = 0; g.Argv[i]; i++)
-	if (strstr(g.Argv[i], "synchronously"))
+	D_("module_init();\n");
+	if (api_version != API_VERSION)
 	{
-	    check = TRUE;
-	    initng_plugin_hook_add(&g.START_DEP_MET, 10, &check_syncronicly);
-
-	    return (TRUE);
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
 	}
-    check = FALSE;
-    /* Notice this is only added if we don't have --synchronously */
-    D_("Adding synchron\n");
-    initng_plugin_hook_add(&g.START_DEP_MET, 10, &check_syncronicly_service);
 
+	initng_service_data_types_add(&SYNCRON);
+	for (i = 0; g.Argv[i]; i++)
+		if (strstr(g.Argv[i], "synchronously"))
+		{
+			check = TRUE;
+			initng_plugin_hook_add(&g.START_DEP_MET, 10, &check_syncronicly);
+
+			return (TRUE);
+		}
+	check = FALSE;
+	/* Notice this is only added if we don't have --synchronously */
+	D_("Adding synchron\n");
+	initng_plugin_hook_add(&g.START_DEP_MET, 10, &check_syncronicly_service);
 
-    return (TRUE);
+
+	return (TRUE);
 }
 
 void module_unload(void)
 {
 
-    if (check == TRUE)
-	initng_plugin_hook_del(&g.START_DEP_MET, &check_syncronicly);
-    initng_plugin_hook_del(&g.START_DEP_MET, &check_syncronicly_service);
-    initng_service_data_types_del(&SYNCRON);
+	if (check == TRUE)
+		initng_plugin_hook_del(&g.START_DEP_MET, &check_syncronicly);
+	initng_plugin_hook_del(&g.START_DEP_MET, &check_syncronicly_service);
+	initng_service_data_types_del(&SYNCRON);
 }

Modified: initng/trunk/plugins/syslog/initng_syslog.c
==============================================================================
--- initng/trunk/plugins/syslog/initng_syslog.c	(original)
+++ initng/trunk/plugins/syslog/initng_syslog.c	Wed Apr  5 23:11:19 2006
@@ -20,13 +20,13 @@
 
 #include <initng.h>
 
-#include <sys/types.h>			    /* time_t */
+#include <sys/types.h>						/* time_t */
 #include <sys/stat.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <stdio.h>			    /* printf() */
+#include <stdio.h>							/* printf() */
 #include <assert.h>
 #include <stdarg.h>
 #include <syslog.h>
@@ -49,308 +49,308 @@
 
 static void check_syslog(void)
 {
-    struct stat st;
+	struct stat st;
 
-    if (stat("/dev/log", &st) == 0 && S_ISSOCK(st.st_mode))
-    {
-	syslog_running = 1;
-
-	/* print out the buffers if any now */
-	if (!list_empty(&log_list.list))
+	if (stat("/dev/log", &st) == 0 && S_ISSOCK(st.st_mode))
 	{
-	    log_ent *current, *safe = NULL;
+		syslog_running = 1;
 
-	    while_log_list_safe(current, safe)
-	    {
-		initng_log(current->prio, current->owner, "%s",
-			   current->buffert);
-		free(current->buffert);
-		if (current->owner)
-		    free(current->owner);
-		list_del(&current->list);
-	    }
-	    INIT_LIST_HEAD(&log_list.list);
+		/* print out the buffers if any now */
+		if (!list_empty(&log_list.list))
+		{
+			log_ent *current, *safe = NULL;
+
+			while_log_list_safe(current, safe)
+			{
+				initng_log(current->prio, current->owner, "%s",
+						   current->buffert);
+				free(current->buffert);
+				if (current->owner)
+					free(current->owner);
+				list_del(&current->list);
+			}
+			INIT_LIST_HEAD(&log_list.list);
+		}
+	}
+	else
+	{
+		syslog_running = 0;
 	}
-    }
-    else
-    {
-	syslog_running = 0;
-    }
 }
 
 static void free_buffert(void)
 {
-    log_ent *current, *safe = NULL;
+	log_ent *current, *safe = NULL;
 
-    /* give syslog a last chance to come alive */
-    check_syslog();
-    while_log_list_safe(current, safe)
-    {
-	free(current->buffert);
-	if (current->owner)
-	    free(current->owner);
-	list_del(&current->list);
-    }
-    INIT_LIST_HEAD(&log_list.list);
+	/* give syslog a last chance to come alive */
+	check_syslog();
+	while_log_list_safe(current, safe)
+	{
+		free(current->buffert);
+		if (current->owner)
+			free(current->owner);
+		list_del(&current->list);
+	}
+	INIT_LIST_HEAD(&log_list.list);
 
-    /* log directly to syslog from now, even if it might not exist */
-    syslog_running = 1;
+	/* log directly to syslog from now, even if it might not exist */
+	syslog_running = 1;
 }
 
 static void initng_log(int prio, const char *owner, const char *format, ...)
 {
-    va_list ap;
+	va_list ap;
 
-    va_start(ap, format);
+	va_start(ap, format);
 
 
-    /* if syslog is running, send it directly */
-    if (syslog_running == 1)
-    {
-	/* if owner is set, we have openlog with right owner */
-	if (owner)
+	/* if syslog is running, send it directly */
+	if (syslog_running == 1)
 	{
-	    closelog();
-	    openlog(owner, 0, LOG_LOCAL1);
+		/* if owner is set, we have openlog with right owner */
+		if (owner)
+		{
+			closelog();
+			openlog(owner, 0, LOG_LOCAL1);
+
+			vsyslog(prio, format, ap);
+
+			closelog();
+			openlog("InitNG", 0, LOG_LOCAL1);
+		}
+		else
+			vsyslog(prio, format, ap);
 
-	    vsyslog(prio, format, ap);
-
-	    closelog();
-	    openlog("InitNG", 0, LOG_LOCAL1);
 	}
 	else
-	    vsyslog(prio, format, ap);
+	{
+		char b[201];
+		log_ent *tmp = (log_ent *) i_calloc(1, sizeof(log_ent));
 
-    }
-    else
-    {
-	char b[201];
-	log_ent *tmp = (log_ent *) i_calloc(1, sizeof(log_ent));
-
-	if (!tmp)
-	    return;
-
-	tmp->prio = prio;
-	vsnprintf(b, 200, format, ap);
-	tmp->buffert = i_strdup(b);
+		if (!tmp)
+			return;
 
-	if (owner)
-	    tmp->owner = i_strdup(owner);
-	else
-	    tmp->owner = NULL;
+		tmp->prio = prio;
+		vsnprintf(b, 200, format, ap);
+		tmp->buffert = i_strdup(b);
+
+		if (owner)
+			tmp->owner = i_strdup(owner);
+		else
+			tmp->owner = NULL;
 
-	list_add(&tmp->list, &log_list.list);
+		list_add(&tmp->list, &log_list.list);
 
-    }
+	}
 
-    va_end(ap);
+	va_end(ap);
 }
 
 /* add values to syslog database */
 static int syslog_print_status_change(active_db_h * service)
 {
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    if (IS_UP(service))
-    {
-	check_syslog();
-	initng_log(LOG_NOTICE, NULL, "Service %s is up.\n", service->name);
-	return (TRUE);
-    }
+	if (IS_UP(service))
+	{
+		check_syslog();
+		initng_log(LOG_NOTICE, NULL, "Service %s is up.\n", service->name);
+		return (TRUE);
+	}
 
-    if (IS_DOWN(service))
-    {
-	initng_log(LOG_NOTICE, NULL, "Service %s has been stopped.\n",
-		   service->name);
-	return (TRUE);
-    }
-    if (IS_FAILED(service))
-    {
-	initng_log(LOG_NOTICE, NULL, "Service %s FAILED.\n", service->name);
-	return (TRUE);
-    }
+	if (IS_DOWN(service))
+	{
+		initng_log(LOG_NOTICE, NULL, "Service %s has been stopped.\n",
+				   service->name);
+		return (TRUE);
+	}
+	if (IS_FAILED(service))
+	{
+		initng_log(LOG_NOTICE, NULL, "Service %s FAILED.\n", service->name);
+		return (TRUE);
+	}
 
-    if (IS_STOPPING(service))
-    {
-	initng_log(LOG_NOTICE, NULL, "Service %s is stopping.\n",
-		   service->name);
-	return (TRUE);
-    }
+	if (IS_STOPPING(service))
+	{
+		initng_log(LOG_NOTICE, NULL, "Service %s is stopping.\n",
+				   service->name);
+		return (TRUE);
+	}
 
-    if (IS_STARTING(service))
-    {
-	initng_log(LOG_NOTICE, NULL, "Service %s is starting.\n",
-		   service->name);
-	return (TRUE);
-    }
+	if (IS_STARTING(service))
+	{
+		initng_log(LOG_NOTICE, NULL, "Service %s is starting.\n",
+				   service->name);
+		return (TRUE);
+	}
 
-    /* leave */
-    return (TRUE);
+	/* leave */
+	return (TRUE);
 }
 
 static void syslog_print_system_state(h_sys_state state)
 {
-    switch (state)
-    {
-	case STATE_UP:
-	    initng_log(LOG_NOTICE, NULL, "System is up and running!\n");
-	    /*
-	     * if syslogd have not been started yet, its no ida,
-	     * to spend memory for the buffert anyway.
-	     */
-	    free_buffert();
-	    return;
-	case STATE_STARTING:
-	    initng_log(LOG_NOTICE, NULL, "System is starting up.\n");
-	    return;
-	case STATE_STOPPING:
-	    initng_log(LOG_NOTICE, NULL, "System is going down.\n");
-	    return;
-	case STATE_ASE:
-	    initng_log(LOG_NOTICE, NULL, "Last service exited.\n");
-	    return;
-	case STATE_EXIT:
-	    initng_log(LOG_NOTICE, NULL, "Initng is exiting.\n");
-	    return;
-	case STATE_RESTART:
-	    initng_log(LOG_NOTICE, NULL, "Initng is restarting.\n");
-	    return;
-	case STATE_HALT:
-	    initng_log(LOG_NOTICE, NULL, "System is halting.\n");
-	    return;
-	case STATE_POWEROFF:
-	    initng_log(LOG_NOTICE, NULL, "System is power-off.\n");
-	    return;
-	case STATE_REBOOT:
-	    initng_log(LOG_NOTICE, NULL, "System is rebooting.\n");
-	    return;
-	default:
-	    return;
-    }
-    return;
+	switch (state)
+	{
+		case STATE_UP:
+			initng_log(LOG_NOTICE, NULL, "System is up and running!\n");
+			/*
+			 * if syslogd have not been started yet, its no ida,
+			 * to spend memory for the buffert anyway.
+			 */
+			free_buffert();
+			return;
+		case STATE_STARTING:
+			initng_log(LOG_NOTICE, NULL, "System is starting up.\n");
+			return;
+		case STATE_STOPPING:
+			initng_log(LOG_NOTICE, NULL, "System is going down.\n");
+			return;
+		case STATE_ASE:
+			initng_log(LOG_NOTICE, NULL, "Last service exited.\n");
+			return;
+		case STATE_EXIT:
+			initng_log(LOG_NOTICE, NULL, "Initng is exiting.\n");
+			return;
+		case STATE_RESTART:
+			initng_log(LOG_NOTICE, NULL, "Initng is restarting.\n");
+			return;
+		case STATE_HALT:
+			initng_log(LOG_NOTICE, NULL, "System is halting.\n");
+			return;
+		case STATE_POWEROFF:
+			initng_log(LOG_NOTICE, NULL, "System is power-off.\n");
+			return;
+		case STATE_REBOOT:
+			initng_log(LOG_NOTICE, NULL, "System is rebooting.\n");
+			return;
+		default:
+			return;
+	}
+	return;
 }
 
 static int syslog_fetch_output(active_db_h * service, process_h * process,
-			       char *buffer_pos)
+							   char *buffer_pos)
 {
-    char log[201];
-    int pos = 0;
-    int i;
-
-    assert(service);
-    assert(service->name);
-
-    /* print every line, ending with a '\n' as an own syslog */
-    while (buffer_pos[pos])
-    {
-	i = 0;
-	/* count the number of char before '\n' */
-	while (buffer_pos[pos + i] && buffer_pos[pos + i] != '\n' && i < 200)
-	    i++;
-
-	/* copy that many chars to our temporary log array */
-	strncpy(log, &buffer_pos[pos], i);
-	log[i] = '\0';
-
-	/* send it to syslog */
-	initng_log(LOG_NOTICE, service->name, "%s", log);
-
-	/* step forward */
-	pos += i;
-
-	/* and skip the newline if any */
-	if (buffer_pos[pos])
-	    pos++;
+	char log[201];
+	int pos = 0;
+	int i;
+
+	assert(service);
+	assert(service->name);
+
+	/* print every line, ending with a '\n' as an own syslog */
+	while (buffer_pos[pos])
+	{
+		i = 0;
+		/* count the number of char before '\n' */
+		while (buffer_pos[pos + i] && buffer_pos[pos + i] != '\n' && i < 200)
+			i++;
+
+		/* copy that many chars to our temporary log array */
+		strncpy(log, &buffer_pos[pos], i);
+		log[i] = '\0';
+
+		/* send it to syslog */
+		initng_log(LOG_NOTICE, service->name, "%s", log);
+
+		/* step forward */
+		pos += i;
+
+		/* and skip the newline if any */
+		if (buffer_pos[pos])
+			pos++;
 
-    }
-    return (TRUE);
+	}
+	return (TRUE);
 }
 
 
 static int syslog_print_error(e_mt mt, const char *file, const char *func,
-			      int line, const char *format, va_list arg)
+							  int line, const char *format, va_list arg)
 {
-    assert(file);
-    assert(func);
-    assert(format);
-    char tempspace[200];
-
-    vsnprintf(tempspace, 200, format, arg);
-
-    switch (mt)
-    {
-	case MSG_FAIL:
+	assert(file);
+	assert(func);
+	assert(format);
+	char tempspace[200];
+
+	vsnprintf(tempspace, 200, format, arg);
+
+	switch (mt)
+	{
+		case MSG_FAIL:
 #ifdef DEBUG
-	    syslog(LOG_EMERG, "\"%s\", %s() #%i FAIL: %s", file, func, line,
-		   tempspace);
+			syslog(LOG_EMERG, "\"%s\", %s() #%i FAIL: %s", file, func, line,
+				   tempspace);
 #else
-	    syslog(LOG_EMERG, "FAIL: %s", tempspace);
+			syslog(LOG_EMERG, "FAIL: %s", tempspace);
 #endif
-	    return (TRUE);
-	case MSG_WARN:
+			return (TRUE);
+		case MSG_WARN:
 #ifdef DEBUG
-	    syslog(LOG_WARNING, "\"%s\", %s() #%i WARN: %s", file, func, line,
-		   tempspace);
+			syslog(LOG_WARNING, "\"%s\", %s() #%i WARN: %s", file, func, line,
+				   tempspace);
 #else
-	    syslog(LOG_EMERG, "WARN: %s", tempspace);
+			syslog(LOG_EMERG, "WARN: %s", tempspace);
 #endif
-	    return (TRUE);
-	default:
-	    syslog(LOG_NOTICE, "%s", tempspace);
-	    return (TRUE);
-    }
+			return (TRUE);
+		default:
+			syslog(LOG_NOTICE, "%s", tempspace);
+			return (TRUE);
+	}
 
-    /* newer get here */
-    return (FALSE);
+	/* newer get here */
+	return (FALSE);
 }
 
 
 
 int module_init(int api_version)
 {
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    /* Don't clutter syslog in fake mode */
-    if (getpid() != 1 || !g.i_am_init)
-    {
-	W_("Pid is not 1, (%i), or g.i_am_init not set and the syslog plugin won't load when running in fake mode, to prevent cluttering up the log-files.\n", getpid());
-	return (TRUE);
-    }
-    D_("Initializing syslog plugin\n");
+	/* Don't clutter syslog in fake mode */
+	if (getpid() != 1 || !g.i_am_init)
+	{
+		W_("Pid is not 1, (%i), or g.i_am_init not set and the syslog plugin won't load when running in fake mode, to prevent cluttering up the log-files.\n", getpid());
+		return (TRUE);
+	}
+	D_("Initializing syslog plugin\n");
 
-    INIT_LIST_HEAD(&log_list.list);
-    check_syslog();
+	INIT_LIST_HEAD(&log_list.list);
+	check_syslog();
 
-    setlogmask(LOG_UPTO(LOG_NOTICE));
-    openlog("InitNG", 0, LOG_LOCAL1);
+	setlogmask(LOG_UPTO(LOG_NOTICE));
+	openlog("InitNG", 0, LOG_LOCAL1);
 
-    initng_plugin_hook_add(&g.IS_CHANGE, 100, &syslog_print_status_change);
-    initng_plugin_hook_add(&g.SWATCHERS, 100, &syslog_print_system_state);
-    initng_plugin_hook_add(&g.PIPEWATCHERS, 100, &syslog_fetch_output);
-    initng_plugin_hook_add(&g.ERR_MSG, 50, &syslog_print_error);
+	initng_plugin_hook_add(&g.IS_CHANGE, 100, &syslog_print_status_change);
+	initng_plugin_hook_add(&g.SWATCHERS, 100, &syslog_print_system_state);
+	initng_plugin_hook_add(&g.PIPEWATCHERS, 100, &syslog_fetch_output);
+	initng_plugin_hook_add(&g.ERR_MSG, 50, &syslog_print_error);
 
-    return (TRUE);
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    /* Don't clutter syslog in fake mode */
-    if (!g.i_am_init)
-    {
-	D_("The syslog plugin won't load when running in fake mode, to prevent cluttering up the log-files.\n");
-	return;
-    }
+	/* Don't clutter syslog in fake mode */
+	if (!g.i_am_init)
+	{
+		D_("The syslog plugin won't load when running in fake mode, to prevent cluttering up the log-files.\n");
+		return;
+	}
 
-    initng_plugin_hook_del(&g.IS_CHANGE, &syslog_print_status_change);
-    initng_plugin_hook_del(&g.SWATCHERS, &syslog_print_system_state);
-    initng_plugin_hook_del(&g.PIPEWATCHERS, &syslog_fetch_output);
-    initng_plugin_hook_del(&g.ERR_MSG, &syslog_print_error);
-    free_buffert();
-    closelog();
+	initng_plugin_hook_del(&g.IS_CHANGE, &syslog_print_status_change);
+	initng_plugin_hook_del(&g.SWATCHERS, &syslog_print_system_state);
+	initng_plugin_hook_del(&g.PIPEWATCHERS, &syslog_fetch_output);
+	initng_plugin_hook_del(&g.ERR_MSG, &syslog_print_error);
+	free_buffert();
+	closelog();
 }

Modified: initng/trunk/plugins/syslog/initng_syslog.h
==============================================================================
--- initng/trunk/plugins/syslog/initng_syslog.h	(original)
+++ initng/trunk/plugins/syslog/initng_syslog.h	Wed Apr  5 23:11:19 2006
@@ -25,10 +25,10 @@
 
 typedef struct
 {
-    int prio;
-    char *owner;
-    char *buffert;
-    struct list_head list;
+	int prio;
+	char *owner;
+	char *buffert;
+	struct list_head list;
 } log_ent;
 
 #define while_log_list_safe(current, safe) list_for_each_entry_prev_safe(current, safe, &log_list.list, list)

Modified: initng/trunk/plugins/unneeded/initng_unneeded.c
==============================================================================
--- initng/trunk/plugins/unneeded/initng_unneeded.c	(original)
+++ initng/trunk/plugins/unneeded/initng_unneeded.c	Wed Apr  5 23:11:19 2006
@@ -53,78 +53,78 @@
 
 static int cmd_stop_unneeded(char *arg);
 s_command STOP_UNNEEDED = { 'y', "stop_unneeded", TRUE_OR_FALSE_COMMAND,
-    STANDARD_COMMAND, NO_OPT,
-    {(void *) &cmd_stop_unneeded},
-    "Stop all services, not in runlevel"
+	STANDARD_COMMAND, NO_OPT,
+	{(void *) &cmd_stop_unneeded},
+	"Stop all services, not in runlevel"
 };
 
 static int cmd_stop_unneeded(char *arg)
 {
 
-    int needed = FALSE;
-    active_db_h *A, *As = NULL;
-    active_db_h *B = NULL;
-    stype_h *TYPE_RUNLEVEL = initng_service_types_get("runlevel");
-
-    S_;
-
-    /* walk through all and check */
-    while_active_db_safe(A, As)
-    {
-	if (A->type == TYPE_RUNLEVEL)
-	    continue;
-
-	/* reset variables */
-	needed = FALSE;
-	B = NULL;
+	int needed = FALSE;
+	active_db_h *A, *As = NULL;
+	active_db_h *B = NULL;
+	stype_h *TYPE_RUNLEVEL = initng_service_types_get("runlevel");
 
-	while_active_db(B)
+	S_;
+
+	/* walk through all and check */
+	while_active_db_safe(A, As)
 	{
-	    /* don't check ourself */
-	    if (A == B)
-		continue;
-
-	    /* if B needs A */
-	    if (initng_depend(B, A) == TRUE)
-	    {
-		needed = TRUE;
-		break;
-	    }
-	}
+		if (A->type == TYPE_RUNLEVEL)
+			continue;
 
-	/* if there was no needed this service, stop it */
-	if (needed == FALSE)
-	    initng_handler_stop_service(A);
-    }
+		/* reset variables */
+		needed = FALSE;
+		B = NULL;
+
+		while_active_db(B)
+		{
+			/* don't check ourself */
+			if (A == B)
+				continue;
+
+			/* if B needs A */
+			if (initng_depend(B, A) == TRUE)
+			{
+				needed = TRUE;
+				break;
+			}
+		}
+
+		/* if there was no needed this service, stop it */
+		if (needed == FALSE)
+			initng_handler_stop_service(A);
+	}
 
-    return (TRUE);
+	return (TRUE);
 }
 
 
 
 int module_init(int api_version)
 {
-    D_("module_init(unneeded);\n");
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
+	D_("module_init(unneeded);\n");
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
 
-    initng_command_add(&STOP_UNNEEDED);
+	initng_command_add(&STOP_UNNEEDED);
 
-    D_("libunneeded.so.0.0 loaded!\n");
-    return (TRUE);
+	D_("libunneeded.so.0.0 loaded!\n");
+	return (TRUE);
 }
 
 
 void module_unload(void)
 {
-    D_("module_unload(unneeded);\n");
+	D_("module_unload(unneeded);\n");
 
-    initng_command_del(&STOP_UNNEEDED);
+	initng_command_del(&STOP_UNNEEDED);
 
 
-    D_("libunneeded.so.0.0 unloaded!\n");
+	D_("libunneeded.so.0.0 unloaded!\n");
 
 }

Modified: initng/trunk/plugins/usplash/initng_usplash.c
==============================================================================
--- initng/trunk/plugins/usplash/initng_usplash.c	(original)
+++ initng/trunk/plugins/usplash/initng_usplash.c	Wed Apr  5 23:11:19 2006
@@ -66,68 +66,68 @@
 
 static void usplash_write(char *output)
 {
-    int len = strlen(output) + 1;	// catch \0 as well
-    int fd = open(USPLASH_FIFO, O_WRONLY | O_NONBLOCK);
+	int len = strlen(output) + 1;	// catch \0 as well
+	int fd = open(USPLASH_FIFO, O_WRONLY | O_NONBLOCK);
 
-    if (fd > 0)
-    {
-	D_("USPLASH : Writing data \"%s\" to pipe\n", output);
-	if (write(fd, output, len) != len)
-	    W_("USPLASH : Open ok, but write failed (%s)\n", strerror(errno));
-    }
-    else
-	D_("USPLASH : Can't write data %s to pipe, not open yet.\n", output);
-    close(fd);
+	if (fd > 0)
+	{
+		D_("USPLASH : Writing data \"%s\" to pipe\n", output);
+		if (write(fd, output, len) != len)
+			W_("USPLASH : Open ok, but write failed (%s)\n", strerror(errno));
+	}
+	else
+		D_("USPLASH : Can't write data %s to pipe, not open yet.\n", output);
+	close(fd);
 
 }
 
 #define USPLASH_WRITE(fmt,...) { snprintf(printf_buffer,1024,fmt, ## __VA_ARGS__); usplash_write(printf_buffer); }
 static int print_output(active_db_h * service)
 {
-    assert(service);
-    assert(service->name);
-    int percent = initng_active_db_percent_started();
-
-    if (percent != last_percent)
-    {
-	USPLASH_WRITE("PROGRESS %d", percent);
-	last_percent = percent;
-    }
-    // These seem to take quite a bit of resources for me, and actually slow down boot.
-    // 18 seconds boot without these, 26 with.
-    /*    if (IS_MARK(service,&DONE))
-       USPLASH_WRITE("TEXT %s : DONE",service->name)
-       else if (IS_MARK(service,&RUNNING))
-       USPLASH_WRITE("TEXT %s : RUNNING",service->name)
-       else if (IS_MARK(service, &STARTING))
-       USPLASH_WRITE("TEXT %s : STARTING",service->name) */
-    return TRUE;
+	assert(service);
+	assert(service->name);
+	int percent = initng_active_db_percent_started();
+
+	if (percent != last_percent)
+	{
+		USPLASH_WRITE("PROGRESS %d", percent);
+		last_percent = percent;
+	}
+	// These seem to take quite a bit of resources for me, and actually slow down boot.
+	// 18 seconds boot without these, 26 with.
+	/*    if (IS_MARK(service,&DONE))
+	   USPLASH_WRITE("TEXT %s : DONE",service->name)
+	   else if (IS_MARK(service,&RUNNING))
+	   USPLASH_WRITE("TEXT %s : RUNNING",service->name)
+	   else if (IS_MARK(service, &STARTING))
+	   USPLASH_WRITE("TEXT %s : STARTING",service->name) */
+	return TRUE;
 }
 
 int module_init(int api_version)
 {
-    D_("usplash: module_load();\n");
-    last_percent = 0;
-    if (api_version != API_VERSION)
-    {
-	F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
-	return (FALSE);
-    }
-    initng_plugin_hook_add(&g.ASTATUS_CHANGE, 80, &print_output);
+	D_("usplash: module_load();\n");
+	last_percent = 0;
+	if (api_version != API_VERSION)
+	{
+		F_("This module is compiled for api_version %i version and initng is compiled on %i version, won't load this module!\n", API_VERSION, api_version);
+		return (FALSE);
+	}
+	initng_plugin_hook_add(&g.ASTATUS_CHANGE, 80, &print_output);
 
 
-    return (TRUE);
+	return (TRUE);
 }
 
 void module_unload(void)
 {
-    D_("usplash: module_unload();\n");
+	D_("usplash: module_unload();\n");
 
-    /*
-     * maybe this is still loaded ?
-     * what can happen if we try to unload it and it has already been unloaded ?
-     */
-    initng_plugin_hook_del(&g.ASTATUS_CHANGE, &print_output);
+	/*
+	 * maybe this is still loaded ?
+	 * what can happen if we try to unload it and it has already been unloaded ?
+	 */
+	initng_plugin_hook_del(&g.ASTATUS_CHANGE, &print_output);
 
-    /*    initng_del_hook(SWATCHERS, &print_system_state); */
+	/*    initng_del_hook(SWATCHERS, &print_system_state); */
 }

Modified: initng/trunk/src/initng.h
==============================================================================
--- initng/trunk/src/initng.h	(original)
+++ initng/trunk/src/initng.h	Wed Apr  5 23:11:19 2006
@@ -26,7 +26,7 @@
 #endif
 
 #define _GNU_SOURCE
-#include <stdio.h>			    /* printf */
+#include <stdio.h>							/* printf */
 #include "initng_error.h"
 
 /* Undef TRUE FALSE FAIL, so not compiled complains about redefining */

Modified: initng/trunk/src/initng_active_db.c
==============================================================================
--- initng/trunk/src/initng_active_db.c	(original)
+++ initng/trunk/src/initng_active_db.c	Wed Apr  5 23:11:19 2006
@@ -49,23 +49,23 @@
  */
 active_db_h *initng_active_db_find_by_exact_name(const char *service)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    D_("(%s);\n", (char *) service);
+	D_("(%s);\n", (char *) service);
 
-    assert(service);
+	assert(service);
 
-    /* first, search for an exact match */
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* check if this service name is like service */
-	if (strcmp(current->name, service) == 0)
-	    return (current);		    /* return it */
-    }
+	/* first, search for an exact match */
+	while_active_db(current)
+	{
+		assert(current->name);
+		/* check if this service name is like service */
+		if (strcmp(current->name, service) == 0)
+			return (current);				/* return it */
+	}
 
-    /* did not find any */
-    return NULL;
+	/* did not find any */
+	return NULL;
 }
 
 /*
@@ -74,31 +74,31 @@
  */
 active_db_h *initng_active_db_find_by_name(const char *service)
 {
-    assert(service);
-    active_db_h *current = NULL;
+	assert(service);
+	active_db_h *current = NULL;
 
-    D_("(%s);\n", (char *) service);
+	D_("(%s);\n", (char *) service);
 
-    /* first give the exact find a shot */
-    if ((current = initng_active_db_find_by_exact_name(service)))
-	return (current);
+	/* first give the exact find a shot */
+	if ((current = initng_active_db_find_by_exact_name(service)))
+		return (current);
 
 
-    /* did not find any */
-    return NULL;
+	/* did not find any */
+	return NULL;
 
-    /* no need in pattern matching, because of unique names in cache (TheLich) */
+	/* no need in pattern matching, because of unique names in cache (TheLich) */
 
-    /* walk the active db and compere */
-    current = NULL;
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* then try to find alike name */
-	if (service_match(current->name, service))
-	    return (current);
+	/* walk the active db and compere */
+	current = NULL;
+	while_active_db(current)
+	{
+		assert(current->name);
+		/* then try to find alike name */
+		if (service_match(current->name, service))
+			return (current);
 
-    }
+	}
 }
 
 /*
@@ -107,30 +107,30 @@
  */
 int reload_service_cache(data_head * head)
 {
-    active_db_h *service = NULL;
+	active_db_h *service = NULL;
 
-    /*printf("reload_service_cache();\n"); */
-    if (head->res)
-	return (TRUE);
-
-    /* Get the service pointer */
-    service = list_entry(head, active_db_h, data);
+	/*printf("reload_service_cache();\n"); */
+	if (head->res)
+		return (TRUE);
+
+	/* Get the service pointer */
+	service = list_entry(head, active_db_h, data);
+
+	/* Check if from_service is set */
+	if (service->from_service)
+		/* point the resursive data pointer, to the service_cache data head */
+		head->res = &service->from_service->data;
 
-    /* Check if from_service is set */
-    if (service->from_service)
-	/* point the resursive data pointer, to the service_cache data head */
-	head->res = &service->from_service->data;
-
-    /* OK, try reload data from disk then */
-    if (initng_common_get_service(service) && service->from_service)
-    {
-	/* point the resursive data pointer, to the service_cache data head */
-	head->res = &service->from_service->data;
-	return (TRUE);
-    }
+	/* OK, try reload data from disk then */
+	if (initng_common_get_service(service) && service->from_service)
+	{
+		/* point the resursive data pointer, to the service_cache data head */
+		head->res = &service->from_service->data;
+		return (TRUE);
+	}
 
-    printf("Failed to reload service_cache for %s\n", service->name);
-    return (FALSE);
+	printf("Failed to reload service_cache for %s\n", service->name);
+	return (FALSE);
 }
 
 /*
@@ -139,97 +139,97 @@
  */
 active_db_h *initng_active_db_find_in_name(const char *service)
 {
-    active_db_h *current = NULL;
-    char *copy = NULL;
-    int i = 0;
-
-    assert(service);
-
-    D_("(%s);\n", (char *) service);
-
-    /* first search by name */
-    if ((current = initng_active_db_find_by_name(service)))
-	return (current);
-
-    /* if the string contains a '/' it is looking for an exact match, so no searching here */
-    for (i = 0; service[i]; i++)
-	if (service[i] == '/')
-	    return (NULL);
-
-    /* remove starting wildcards */
-    while (service[0] == '*' || service[0] == '?')
-	service++;
-
-    copy = i_strdup(service);
-    assert(copy);
-
-    /* remove last wildcards */
-    for (i = 0; copy[i]; i++)
-    {
-	if (copy[i] == '*' || copy[i] == '?')
-	    copy[i] = '\0';
-    }
-
-    /* then search for a word match */
-    current = NULL;
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* check if this service name is like service */
-	if (strstr(current->name, copy))
-	{
-	    D_("Warning, the return is not an exact match!\n");
-	    free(copy);
-	    return (current);		    /* return it */
+	active_db_h *current = NULL;
+	char *copy = NULL;
+	int i = 0;
+
+	assert(service);
+
+	D_("(%s);\n", (char *) service);
+
+	/* first search by name */
+	if ((current = initng_active_db_find_by_name(service)))
+		return (current);
+
+	/* if the string contains a '/' it is looking for an exact match, so no searching here */
+	for (i = 0; service[i]; i++)
+		if (service[i] == '/')
+			return (NULL);
+
+	/* remove starting wildcards */
+	while (service[0] == '*' || service[0] == '?')
+		service++;
+
+	copy = i_strdup(service);
+	assert(copy);
+
+	/* remove last wildcards */
+	for (i = 0; copy[i]; i++)
+	{
+		if (copy[i] == '*' || copy[i] == '?')
+			copy[i] = '\0';
 	}
-    }
-    free(copy);
 
-    /* did not find any */
-    return NULL;
+	/* then search for a word match */
+	current = NULL;
+	while_active_db(current)
+	{
+		assert(current->name);
+		/* check if this service name is like service */
+		if (strstr(current->name, copy))
+		{
+			D_("Warning, the return is not an exact match!\n");
+			free(copy);
+			return (current);				/* return it */
+		}
+	}
+	free(copy);
+
+	/* did not find any */
+	return NULL;
 }
 
 /* return index of service in active data structure or -1 if not found */
 active_db_h *initng_active_db_find_by_service_h(service_cache_h * service)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* walk the active_db */
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* check if this service->from_service is like service */
-	if (current->from_service && current->from_service == service)
-	    return (current);		    /* return it */
+	/* walk the active_db */
+	while_active_db(current)
+	{
+		assert(current->name);
+		/* check if this service->from_service is like service */
+		if (current->from_service && current->from_service == service)
+			return (current);				/* return it */
 
-    }
+	}
 
-    return NULL;
+	return NULL;
 }
 
 /* returns pointer to active_h process belongs to, and sets process_type */
 active_db_h *initng_active_db_find_by_pid(pid_t pid)
 {
-    active_db_h *currentA = NULL;
-    process_h *currentP = NULL;
+	active_db_h *currentA = NULL;
+	process_h *currentP = NULL;
 
-    /* walk the active_db */
-    while_active_db(currentA)
-    {
-	assert(currentA->name);
-	currentP = NULL;
-	while_processes(currentP, currentA)
+	/* walk the active_db */
+	while_active_db(currentA)
 	{
-	    if (currentP->pid == pid)
-		return (currentA);
+		assert(currentA->name);
+		currentP = NULL;
+		while_processes(currentP, currentA)
+		{
+			if (currentP->pid == pid)
+				return (currentA);
+		}
 	}
-    }
 
-    /* bad luck */
-    return (NULL);
+	/* bad luck */
+	return (NULL);
 }
 
 /* #########   STRUCT/CHAIN HANDLE  ######## */
@@ -238,23 +238,23 @@
 /* remember to free service, if this fails */
 int initng_active_db_add(active_db_h * add_this)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* we have to get this data */
-    assert(add_this);
-    assert(add_this->name);
-
-    /* Look for duplicate */
-    if ((current = initng_active_db_find_by_name(add_this->name)))
-    {
-	/* TODO, should add_this bee freed? */
-	W_("active_db_add(%s): duplicate here\n", add_this->name);
-	return (FALSE);
-    }
+	/* we have to get this data */
+	assert(add_this);
+	assert(add_this->name);
 
-    list_add(&add_this->list, &g.active_database.list);
+	/* Look for duplicate */
+	if ((current = initng_active_db_find_by_name(add_this->name)))
+	{
+		/* TODO, should add_this bee freed? */
+		W_("active_db_add(%s): duplicate here\n", add_this->name);
+		return (FALSE);
+	}
 
-    return (TRUE);
+	list_add(&add_this->list, &g.active_database.list);
+
+	return (TRUE);
 }
 
 /* ############    ACTIVE_DB_ALLOC/FREE ##########  */
@@ -262,101 +262,101 @@
 /* creates a new active_h at new_active */
 active_db_h *initng_active_db_new(const char *name)
 {
-    active_db_h *new_active = NULL;
+	active_db_h *new_active = NULL;
 
-    assert(name);
+	assert(name);
 
-    /* allocate a new active entry */
-    new_active = (active_db_h *) i_calloc(1, sizeof(active_db_h));	/* Allocate memory for a new active */
-    if (!new_active)			    /* out of memory? */
-    {
-	F_("Unable to allocate active, out of memory?\n");
-	return (NULL);
-    }
-
-    /* set the name */
-    new_active->name = i_strdup(name);
-    if (!new_active->name)
-    {
-	F_("Unable to set name, out of memory?\n");
-	return (NULL);
-    }
+	/* allocate a new active entry */
+	new_active = (active_db_h *) i_calloc(1, sizeof(active_db_h));	/* Allocate memory for a new active */
+	if (!new_active)						/* out of memory? */
+	{
+		F_("Unable to allocate active, out of memory?\n");
+		return (NULL);
+	}
 
-    DATA_HEAD_INIT_REQUEST(&new_active->data, NULL, &reload_service_cache);
+	/* set the name */
+	new_active->name = i_strdup(name);
+	if (!new_active->name)
+	{
+		F_("Unable to set name, out of memory?\n");
+		return (NULL);
+	}
 
-    /* initialize the data and process list */
-    INIT_LIST_HEAD(&(new_active->processes.list));
+	DATA_HEAD_INIT_REQUEST(&new_active->data, NULL, &reload_service_cache);
 
-    /* get the time, and copy that time to all time entries */
-    gettimeofday(&new_active->time_current_state, NULL);
-    memcpy(&new_active->time_last_state, &new_active->time_current_state,
-	   sizeof(struct timeval));
-    memcpy(&new_active->last_rought_time, &new_active->time_current_state,
-	   sizeof(struct timeval));
+	/* initialize the data and process list */
+	INIT_LIST_HEAD(&(new_active->processes.list));
 
-    /* mark this service as stopped, because it is not yet starting, or running */
-    new_active->current_state = &NEW;
-    new_active->from_service = NULL;
+	/* get the time, and copy that time to all time entries */
+	gettimeofday(&new_active->time_current_state, NULL);
+	memcpy(&new_active->time_last_state, &new_active->time_current_state,
+		   sizeof(struct timeval));
+	memcpy(&new_active->last_rought_time, &new_active->time_current_state,
+		   sizeof(struct timeval));
+
+	/* mark this service as stopped, because it is not yet starting, or running */
+	new_active->current_state = &NEW;
+	new_active->from_service = NULL;
 
-    /* reset alarm */
-    new_active->alarm = 0;
+	/* reset alarm */
+	new_active->alarm = 0;
 
-    /* return the newly created active_db_h */
-    return (new_active);
+	/* return the newly created active_db_h */
+	return (new_active);
 }
 
 /* free some values in this one */
 void initng_active_db_free(active_db_h * pf)
 {
-    process_h *current = NULL;
-    process_h *safe = NULL;
+	process_h *current = NULL;
+	process_h *safe = NULL;
+
+	assert(pf);
+	assert(pf->name);
+
+	D_("(%s);\n", pf->name);
+
+	/* look if there are plug-ins, that is interested to now, this is freeing */
+	initng_common_mark_service(pf, &FREEING);
 
-    assert(pf);
-    assert(pf->name);
+	while_processes_safe(current, safe, pf)
+	{
+		list_del(&current->list);
+		initng_process_db_free(current);
+	}
+
+	/* remove every data entry */
+	dfree_all(pf);
 
-    D_("(%s);\n", pf->name);
+	/* remove file cache of entry if present, so we got a fresh read from file when this service is restarted */
+	if (pf->from_service)
+	{
+		/* remove from cache list */
+		list_del(&pf->from_service->list);
+		/* free entry */
+		initng_service_cache_free(pf->from_service);
+	}
 
-    /* look if there are plug-ins, that is interested to now, this is freeing */
-    initng_common_mark_service(pf, &FREEING);
-
-    while_processes_safe(current, safe, pf)
-    {
-	list_del(&current->list);
-	initng_process_db_free(current);
-    }
-
-    /* remove every data entry */
-    dfree_all(pf);
-
-    /* remove file cache of entry if present, so we got a fresh read from file when this service is restarted */
-    if (pf->from_service)
-    {
-	/* remove from cache list */
-	list_del(&pf->from_service->list);
-	/* free entry */
-	initng_service_cache_free(pf->from_service);
-    }
-
-    /* free service name */
-    if (pf->name)
-	free(pf->name);
+	/* free service name */
+	if (pf->name)
+		free(pf->name);
 
-    /* free service struct */
-    free(pf);
+	/* free service struct */
+	free(pf);
 }
 
 
 /* clear database */
 void initng_active_db_free_all(void)
 {
-    active_db_h *current, *safe = NULL;
+	active_db_h *current, *safe = NULL;
 
-    while_active_db_safe(current, safe)
-    {
-	assert(current->name);
-	list_del(&current->list);
-	initng_active_db_free(current);
-    }
+	while_active_db_safe(current, safe)
+	{
+		assert(current->name);
+		list_del(&current->list);
+		initng_active_db_free(current);
+	}
 }
 
 /* #########  ACTIVE_DB_UTILS  #############  */
@@ -365,187 +365,187 @@
 /* compensate time */
 void initng_active_db_compensate_time(time_t skew)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* walk the active_db */
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* change this time */
-	current->time_current_state.tv_sec += skew;
-	current->time_last_state.tv_sec += skew;
-	current->last_rought_time.tv_sec += skew;
-	current->alarm += skew;
-    }
+	/* walk the active_db */
+	while_active_db(current)
+	{
+		assert(current->name);
+		/* change this time */
+		current->time_current_state.tv_sec += skew;
+		current->time_last_state.tv_sec += skew;
+		current->last_rought_time.tv_sec += skew;
+		current->alarm += skew;
+	}
 }
 
 
 /* update all service_h pointers in whole active_db */
 void initng_active_db_change_service_h(service_cache_h * from,
-				       service_cache_h * to)
+									   service_cache_h * to)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    assert(from);
-    /* !assert(to) to can be NULL, if we want clear that entry */
+	assert(from);
+	/* !assert(to) to can be NULL, if we want clear that entry */
 
-    /* walk the active_db */
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* change this time */
-	if (current->from_service == from)
+	/* walk the active_db */
+	while_active_db(current)
 	{
-	    current->from_service = to;
-
-	    /* Reset data resursive pointer, will be set by reload_service_cache */
-	    if (current->from_service)
-		current->data.res = &current->from_service->data;
-	    else
-		current->data.res = NULL;
+		assert(current->name);
+		/* change this time */
+		if (current->from_service == from)
+		{
+			current->from_service = to;
+
+			/* Reset data resursive pointer, will be set by reload_service_cache */
+			if (current->from_service)
+				current->data.res = &current->from_service->data;
+			else
+				current->data.res = NULL;
+		}
 	}
-    }
 }
 
 /* active_db_count counts a type, if null, count all */
 int initng_active_db_count(a_state_h * current_state_to_count)
 {
-    int counter = 0;		/* actives counter */
-    active_db_h *current = NULL;
+	int counter = 0;			/* actives counter */
+	active_db_h *current = NULL;
 
-    /* ok, go COUNT ALL */
-    if (!current_state_to_count)
-    {
-	/* ok, go through all */
-	while_active_db(current)
+	/* ok, go COUNT ALL */
+	if (!current_state_to_count)
 	{
-	    assert(current->name);
-
-	    /* count almost all */
+		/* ok, go through all */
+		while_active_db(current)
+		{
+			assert(current->name);
+
+			/* count almost all */
+
+			/* but not failed services */
+			if (IS_FAILED(current))
+				continue;
+			/* and not stopped */
+			if (IS_DOWN(current))
+				continue;
 
-	    /* but not failed services */
-	    if (IS_FAILED(current))
-		continue;
-	    /* and not stopped */
-	    if (IS_DOWN(current))
-		continue;
+			counter++;
+		}
 
-	    counter++;
+		return (counter);
 	}
 
+	/* ok, go COUNT A SPECIAL */
+	while_active_db(current)
+	{
+		assert(current->name);
+		/* check if this is the status to count */
+		if (current->current_state == current_state_to_count)
+			counter++;
+	}
+	/* return counter */
 	return (counter);
-    }
-
-    /* ok, go COUNT A SPECIAL */
-    while_active_db(current)
-    {
-	assert(current->name);
-	/* check if this is the status to count */
-	if (current->current_state == current_state_to_count)
-	    counter++;
-    }
-    /* return counter */
-    return (counter);
 }
 
 
 /* calculate percent of processes started */
 int initng_active_db_percent_started(void)
 {
-    int starting = 0;
-    int up = 0;
-    int other = 0;
-    float tmp = 0;
-
-    active_db_h *current = NULL;
-
-    /* walk the active_db */
-    while_active_db(current)
-    {
-	assert(current->name);
-	assert(current->current_state);
-
-	/* count starting */
-	if (IS_STARTING(current))
-	{
-	    starting++;
-	    continue;
-	}
-
-	/* count up */
-	if (IS_UP(current))
-	{
-	    up++;
-	    continue;
-	}
-
-	/* count others */
-	other++;
-    }
-    D_("active_db_percent_started(): up: %i   starting: %i  other: %i\n", up,
-       starting, other);
-
-    /* if no one starting */
-    if (starting <= 0)
-	return (100);
-
-    if (up > 0)
-    {
-	tmp = 100 * (float) up / (float) (starting + up);
-	D_("active_db_percent_started(): up/starting: %f percent: %i\n\n",
-	   (float) up / (float) starting, (int) tmp);
-	return ((int) tmp);
-    }
-    return 0;
+	int starting = 0;
+	int up = 0;
+	int other = 0;
+	float tmp = 0;
+
+	active_db_h *current = NULL;
+
+	/* walk the active_db */
+	while_active_db(current)
+	{
+		assert(current->name);
+		assert(current->current_state);
+
+		/* count starting */
+		if (IS_STARTING(current))
+		{
+			starting++;
+			continue;
+		}
+
+		/* count up */
+		if (IS_UP(current))
+		{
+			up++;
+			continue;
+		}
+
+		/* count others */
+		other++;
+	}
+	D_("active_db_percent_started(): up: %i   starting: %i  other: %i\n", up,
+	   starting, other);
+
+	/* if no one starting */
+	if (starting <= 0)
+		return (100);
+
+	if (up > 0)
+	{
+		tmp = 100 * (float) up / (float) (starting + up);
+		D_("active_db_percent_started(): up/starting: %f percent: %i\n\n",
+		   (float) up / (float) starting, (int) tmp);
+		return ((int) tmp);
+	}
+	return 0;
 }
 
 /* calculate percent of processes stopped */
 int initng_active_db_percent_stopped(void)
 {
-    int stopping = 0;
-    int down = 0;
-    int other = 0;
-    float tmp = 0;
-    active_db_h *current = NULL;
-
-    while_active_db(current)
-    {
-	assert(current->name);
-	assert(current->current_state);
-
-	/* count stopped services */
-	if (IS_DOWN(current))
-	{
-	    down++;
-	    continue;
-	}
-
-	/* count stopping */
-	if (IS_STOPPING(current))
-	{
-	    stopping++;
-	    continue;
-	}
-
-	/* count others */
-	other++;
-    }
-
-    D_("active_db_percent_stopped(): down: %i   stopping: %i  other: %i\n",
-       down, stopping, other);
-
-    /* if no one stopping */
-    if (stopping <= 0)
-	return (100);
-
-    if (down > 0)
-    {
-	tmp = 100 * (float) down / (float) (stopping + down);
-	D_("active_db_percent_stopped(): down/stopping: %f percent: %i\n\n",
-	   (float) down / (float) stopping, (int) tmp);
-	return ((int) tmp);
-    }
-    return 0;
+	int stopping = 0;
+	int down = 0;
+	int other = 0;
+	float tmp = 0;
+	active_db_h *current = NULL;
+
+	while_active_db(current)
+	{
+		assert(current->name);
+		assert(current->current_state);
+
+		/* count stopped services */
+		if (IS_DOWN(current))
+		{
+			down++;
+			continue;
+		}
+
+		/* count stopping */
+		if (IS_STOPPING(current))
+		{
+			stopping++;
+			continue;
+		}
+
+		/* count others */
+		other++;
+	}
+
+	D_("active_db_percent_stopped(): down: %i   stopping: %i  other: %i\n",
+	   down, stopping, other);
+
+	/* if no one stopping */
+	if (stopping <= 0)
+		return (100);
+
+	if (down > 0)
+	{
+		tmp = 100 * (float) down / (float) (stopping + down);
+		D_("active_db_percent_stopped(): down/stopping: %f percent: %i\n\n",
+		   (float) down / (float) stopping, (int) tmp);
+		return ((int) tmp);
+	}
+	return 0;
 }
 
 
@@ -557,22 +557,22 @@
  */
 void initng_active_db_clean_down(void)
 {
-    active_db_h *current = NULL;
-    active_db_h *safe = NULL;
-
-    while_active_db_safe(current, safe)
-    {
-	assert(current->name);
-	assert(current->current_state);
+	active_db_h *current = NULL;
+	active_db_h *safe = NULL;
 
-	/* count stopped services */
-	if (!IS_DOWN(current))
-	    continue;
-
-	if (g.now.tv_sec > current->time_current_state.tv_sec + CLEAN_DELAY)
+	while_active_db_safe(current, safe)
 	{
-	    list_del(&current->list);
-	    initng_active_db_free(current);
+		assert(current->name);
+		assert(current->current_state);
+
+		/* count stopped services */
+		if (!IS_DOWN(current))
+			continue;
+
+		if (g.now.tv_sec > current->time_current_state.tv_sec + CLEAN_DELAY)
+		{
+			list_del(&current->list);
+			initng_active_db_free(current);
+		}
 	}
-    }
 }

Modified: initng/trunk/src/initng_active_db.h
==============================================================================
--- initng/trunk/src/initng_active_db.h	(original)
+++ initng/trunk/src/initng_active_db.h	Wed Apr  5 23:11:19 2006
@@ -40,39 +40,39 @@
 /* the active service struct */
 struct active_type
 {
-    /* identification */
-    char *name;
-    stype_h *type;
+	/* identification */
+	char *name;
+	stype_h *type;
 
-    /* service data */
-    service_cache_h *from_service;
+	/* service data */
+	service_cache_h *from_service;
 
-    /* current state */
-    a_state_h *current_state;
-    struct timeval time_current_state;	/* the time got current state */
+	/* current state */
+	a_state_h *current_state;
+	struct timeval time_current_state;	/* the time got current state */
 
-    /* last    state */
-    a_state_h *last_state;
-    struct timeval time_last_state;	/* the time got last state */
+	/* last    state */
+	a_state_h *last_state;
+	struct timeval time_last_state;	/* the time got last state */
 
-    /* Rough  state */
-    e_is last_rought_state;
-    struct timeval last_rought_time;
+	/* Rough  state */
+	e_is last_rought_state;
+	struct timeval last_rought_time;
 
-    /* processes */
-    process_h processes;
+	/* processes */
+	process_h processes;
 
-    /* list container, for data */
-    data_head data;
+	/* list container, for data */
+	data_head data;
 
-    /* Alarm, the current state alarm is run when this time passes */
-    time_t alarm;
+	/* Alarm, the current state alarm is run when this time passes */
+	time_t alarm;
 
-    /* depend cache - Optimizion to speed up UP_DEPS_CHECK */
-    int depend_cache;
+	/* depend cache - Optimizion to speed up UP_DEPS_CHECK */
+	int depend_cache;
 
-    /* the list */
-    struct list_head list;
+	/* the list */
+	struct list_head list;
 };
 
 /* allocate */
@@ -87,7 +87,7 @@
 
 /* mangling */
 void initng_active_db_change_service_h(service_cache_h * from,
-				       service_cache_h * to);
+									   service_cache_h * to);
 void initng_active_db_compensate_time(time_t skew);
 
 /* reload service cache if not set */

Modified: initng/trunk/src/initng_active_state.c
==============================================================================
--- initng/trunk/src/initng_active_state.c	(original)
+++ initng/trunk/src/initng_active_state.c	Wed Apr  5 23:11:19 2006
@@ -29,34 +29,34 @@
 
 int initng_active_state_add(a_state_h * state)
 {
-    assert(state);
+	assert(state);
 
-    /* look for duplicates */
-    if (initng_active_state_find(state->state_name) != NULL)
-    {
-	F_("There exists a state with this state_name (%s) already, please check this!\n", state->state_name);
-	return (FALSE);
-    }
-
-    D_("adding %s.\n", state->state_name);
-    /* add this state, to the big list of states */
-    list_add(&(state->list), &(g.states.list));
+	/* look for duplicates */
+	if (initng_active_state_find(state->state_name) != NULL)
+	{
+		F_("There exists a state with this state_name (%s) already, please check this!\n", state->state_name);
+		return (FALSE);
+	}
+
+	D_("adding %s.\n", state->state_name);
+	/* add this state, to the big list of states */
+	list_add(&(state->list), &(g.states.list));
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 }
 
 a_state_h *initng_active_state_find(const char *state_name)
 {
-    a_state_h *current = NULL;
+	a_state_h *current = NULL;
 
-    assert(state_name);
+	assert(state_name);
 
-    /* walk the state db */
-    while_active_states(current)
-    {
-	if (strcmp(state_name, current->state_name) == 0)
-	    return (current);
-    }
-    return (NULL);
+	/* walk the state db */
+	while_active_states(current)
+	{
+		if (strcmp(state_name, current->state_name) == 0)
+			return (current);
+	}
+	return (NULL);
 }

Modified: initng/trunk/src/initng_active_state.h
==============================================================================
--- initng/trunk/src/initng_active_state.h	(original)
+++ initng/trunk/src/initng_active_state.h	Wed Apr  5 23:11:19 2006
@@ -29,29 +29,29 @@
 
 struct a_state_t
 {
-    /* the name of the state in a string, will be printed */
-    const char *state_name;
+	/* the name of the state in a string, will be printed */
+	const char *state_name;
 
-    /* If this state is set for a service, is it roughly: */
-    e_is is;
+	/* If this state is set for a service, is it roughly: */
+	e_is is;
 
-    /*
-     * This function will be run on service with this state set, if g.interrupt is set.
-     */
-    void (*state_interrupt) (active_db_h * service);
-
-    /*
-     * This will run directly after a service is set this state.
-     */
-    void (*state_init) (active_db_h * service);
-
-    /*
-     * This function will be run when alarm (timeout) is reached
-     */
-    void (*state_alarm) (active_db_h * service);
+	/*
+	 * This function will be run on service with this state set, if g.interrupt is set.
+	 */
+	void (*state_interrupt) (active_db_h * service);
+
+	/*
+	 * This will run directly after a service is set this state.
+	 */
+	void (*state_init) (active_db_h * service);
+
+	/*
+	 * This function will be run when alarm (timeout) is reached
+	 */
+	void (*state_alarm) (active_db_h * service);
 
-    /* The list this struct is in */
-    struct list_head list;
+	/* The list this struct is in */
+	struct list_head list;
 };
 
 int initng_active_state_add(a_state_h * state);

Modified: initng/trunk/src/initng_common.c
==============================================================================
--- initng/trunk/src/initng_common.c	(original)
+++ initng/trunk/src/initng_common.c	Wed Apr  5 23:11:19 2006
@@ -23,15 +23,15 @@
 
 /* system headers */
 #include <sys/time.h>
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdio.h>			    /* printf() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdio.h>							/* printf() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <assert.h>
 
 #include "initng_common.h"
@@ -56,121 +56,121 @@
  */
 int initng_common_service_blacklisted(const char *name)
 {
-    int i;
+	int i;
 
-    assert(name);
-    assert(g.Argv);
+	assert(name);
+	assert(g.Argv);
 
-    /* walk through arguments looking for this dep to be blacklisted */
-    for (i = 1; (g.Argv)[i]; i++)
-    {
-	/* if we got a match */
-	if ((g.Argv)[i][0] == '-')
+	/* walk through arguments looking for this dep to be blacklisted */
+	for (i = 1; (g.Argv)[i]; i++)
 	{
-	    if (strcmp(name, (g.Argv)[i] + 1) == 0
-		|| service_match(name, (g.Argv)[i] + 1))
-		return (TRUE);
+		/* if we got a match */
+		if ((g.Argv)[i][0] == '-')
+		{
+			if (strcmp(name, (g.Argv)[i] + 1) == 0
+				|| service_match(name, (g.Argv)[i] + 1))
+				return (TRUE);
+		}
 	}
-    }
-    return (FALSE);
+	return (FALSE);
 }
 
 /* creates a active service */
 active_db_h *initng_common_load_to_active(const char *service_name)
 {
-    active_db_h *a_new = NULL;
-    active_db_h *current = NULL;
+	active_db_h *a_new = NULL;
+	active_db_h *current = NULL;
 
-    assert(service_name);
-    D_("load_to_active(%s); \n", service_name);
+	assert(service_name);
+	D_("load_to_active(%s); \n", service_name);
 
-    /* check the blacklist db */
-    if (initng_common_service_blacklisted(service_name))
-    {
-	F_("load_to_active(%s): Service BLACKLISTED.\n", service_name);
-	return (NULL);
-    }
+	/* check the blacklist db */
+	if (initng_common_service_blacklisted(service_name))
+	{
+		F_("load_to_active(%s): Service BLACKLISTED.\n", service_name);
+		return (NULL);
+	}
 
-    /* Make sure there isn't any process with this name running */
-    if ((a_new = initng_active_db_find_by_name(service_name)))
-    {
-	F_("load_to_active(%s): Service with same name %s exists! \n",
-	   service_name);
-	return (NULL);
-    }
+	/* Make sure there isn't any process with this name running */
+	if ((a_new = initng_active_db_find_by_name(service_name)))
+	{
+		F_("load_to_active(%s): Service with same name %s exists! \n",
+		   service_name);
+		return (NULL);
+	}
 
-    /* if not create a new active entry, out of memory? */
-    if (!(a_new = initng_active_db_new(service_name)))
-    {
-	D_("load_to_active(%s): Unable to allocate process, out of memory?\n",
-	   service_name);
-	return (NULL);
-    }
+	/* if not create a new active entry, out of memory? */
+	if (!(a_new = initng_active_db_new(service_name)))
+	{
+		D_("load_to_active(%s): Unable to allocate process, out of memory?\n",
+		   service_name);
+		return (NULL);
+	}
 
-    /* this actually loads service from disk */
-    if (!initng_common_get_service(a_new) || !(a_new->from_service))
-    {
-	D_("load_to_active(%s): Can't get service!\n", service_name);
-	if (a_new)
-	    initng_active_db_free(a_new);
-	return (NULL);
-    }
+	/* this actually loads service from disk */
+	if (!initng_common_get_service(a_new) || !(a_new->from_service))
+	{
+		D_("load_to_active(%s): Can't get service!\n", service_name);
+		if (a_new)
+			initng_active_db_free(a_new);
+		return (NULL);
+	}
 
-    /* Mark this service as state LOADING, plug-ins may hook here */
-    if (!initng_common_mark_service(a_new, &LOADING))
-    {
-	W_("Failed to mark service LOADING.\n");
-	if (a_new)
-	    initng_active_db_free(a_new);
-	return (NULL);
-    }
+	/* Mark this service as state LOADING, plug-ins may hook here */
+	if (!initng_common_mark_service(a_new, &LOADING))
+	{
+		W_("Failed to mark service LOADING.\n");
+		if (a_new)
+			initng_active_db_free(a_new);
+		return (NULL);
+	}
 
-    /*
-       if (a_new->from_service->type != TYPE_SERVICE &&
-       a_new->from_service->type != TYPE_DAEMON &&
-       a_new->from_service->type != TYPE_RUNLEVEL)
-       {
-       F_("load_to_active(%s): service is not a service type!\n",
-       service_name);
-       if (a_new)
-       active_db_free(a_new);
-       return (NULL);
-       } */
-
-    /* circular dependencies are BAD, so check this one before adding it to the db */
-    /* dep_on_deep will not crash as long as the offending service is not loaded into the db */
-
-    /* dep_on_deep will loop over the active_db, but as the a_new service is not added to 
-     * the service db up to now, this will not cause an endless loop, cause it will not
-     * loop over a_new */
-
-    /* dep_on_deep() requires dep_on(), which uses string based comparison, and will completely
-     * ignore the active_db. This is at least true for the dep_on() check that's implemented by
-     * the depend plugin(). In future plug-ins, do NOT implement dep_on() code that will require
-     * any of the services being added to the active_db */
-    if (g.no_circular == 0)
-    {
-	while_active_db(current)
+	/*
+	   if (a_new->from_service->type != TYPE_SERVICE &&
+	   a_new->from_service->type != TYPE_DAEMON &&
+	   a_new->from_service->type != TYPE_RUNLEVEL)
+	   {
+	   F_("load_to_active(%s): service is not a service type!\n",
+	   service_name);
+	   if (a_new)
+	   active_db_free(a_new);
+	   return (NULL);
+	   } */
+
+	/* circular dependencies are BAD, so check this one before adding it to the db */
+	/* dep_on_deep will not crash as long as the offending service is not loaded into the db */
+
+	/* dep_on_deep will loop over the active_db, but as the a_new service is not added to 
+	 * the service db up to now, this will not cause an endless loop, cause it will not
+	 * loop over a_new */
+
+	/* dep_on_deep() requires dep_on(), which uses string based comparison, and will completely
+	 * ignore the active_db. This is at least true for the dep_on() check that's implemented by
+	 * the depend plugin(). In future plug-ins, do NOT implement dep_on() code that will require
+	 * any of the services being added to the active_db */
+	if (g.no_circular == 0)
 	{
-	    if (initng_depend_deep(a_new, current)
-		&& initng_depend_deep(current, a_new))
-	    {
-		F_("load_to_active(%s): not loading service %s, because it has a circular dependency on %s\n", service_name, a_new->name, current->name);
-		initng_active_db_free(a_new);
-		return NULL;
-	    }
+		while_active_db(current)
+		{
+			if (initng_depend_deep(a_new, current)
+				&& initng_depend_deep(current, a_new))
+			{
+				F_("load_to_active(%s): not loading service %s, because it has a circular dependency on %s\n", service_name, a_new->name, current->name);
+				initng_active_db_free(a_new);
+				return NULL;
+			}
+		}
 	}
-    }
 
-    /* return with pointer to service */
-    if (initng_active_db_add(a_new) == TRUE)
-	return (a_new);
-
-    /* fail by default */
-    F_("active_db_add() FAILED!\n");
-    if (a_new)
-	initng_active_db_free(a_new);
-    return (NULL);
+	/* return with pointer to service */
+	if (initng_active_db_add(a_new) == TRUE)
+		return (a_new);
+
+	/* fail by default */
+	F_("active_db_add() FAILED!\n");
+	if (a_new)
+		initng_active_db_free(a_new);
+	return (NULL);
 }
 
 
@@ -179,82 +179,82 @@
    this actually loads the config from disk, parser by parser */
 int initng_common_get_service(active_db_h * service)
 {
-    int i = 0;
+	int i = 0;
 
-    assert(service);
-    assert(service->name);
-    D_("get_service(%s);\n", service->name);
-
-    /* check if service is set already */
-    if (service->from_service)
-    {
-	D_("get_service(%s): already have a service!\n", service->name);
-	return (TRUE);
-    }
+	assert(service);
+	assert(service->name);
+	D_("get_service(%s);\n", service->name);
 
-    /* of course, we cant get service data from a virtual */
-    if (strncmp(service->name, "virtual/", 8) == 0)
-	return (FALSE);
+	/* check if service is set already */
+	if (service->from_service)
+	{
+		D_("get_service(%s): already have a service!\n", service->name);
+		return (TRUE);
+	}
 
+	/* of course, we cant get service data from a virtual */
+	if (strncmp(service->name, "virtual/", 8) == 0)
+		return (FALSE);
 
-    /* check the cache database for an exact match */
-    if ((service->from_service =
-	 initng_service_cache_find_by_exact_name(service->name)))
-    {
+
+	/* check the cache database for an exact match */
+	if ((service->from_service =
+		 initng_service_cache_find_by_exact_name(service->name)))
+	{
+		service->type = service->from_service->type;
+		service->data.res = &service->from_service->data;
+		D_("get_service(%s): found service in service database!\n",
+		   service->name);
+		return (TRUE);
+	}
+
+	/* try parse with dynamic loaded parsers */
+	if (!(service->from_service = initng_common_parse_service(service->name)))
+	{
+		/* or fail */
+		D_("get_service(%s): Can't get source.. \n", service->name);
+		return (FALSE);
+	}
 	service->type = service->from_service->type;
 	service->data.res = &service->from_service->data;
-	D_("get_service(%s): found service in service database!\n",
+
+	D_(" get_service(%s): got service from initng dynamic parsers.\n",
 	   service->name);
-	return (TRUE);
-    }
 
-    /* try parse with dynamic loaded parsers */
-    if (!(service->from_service = initng_common_parse_service(service->name)))
-    {
-	/* or fail */
-	D_("get_service(%s): Can't get source.. \n", service->name);
-	return (FALSE);
-    }
-    service->type = service->from_service->type;
-    service->data.res = &service->from_service->data;
-
-    D_(" get_service(%s): got service from initng dynamic parsers.\n",
-       service->name);
-
-    /* will continue here only, if initng_modules_parse did succeed */
-
-    /*
-     * if service->name is "samba", and service->from_service->name is "daemon/samba" 
-     * we have to update service->name.
-     * also notice that service->name should not exactly match service->from_service->name, 
-     * service->name might be "eth0" and service->from_service->name might be "net / *".
-     */
-
-    /* cont the tokens to the first '/' */
-    while (service->from_service->name[i]
-	   && service->from_service->name[i] != '/')
-	i++;
+	/* will continue here only, if initng_modules_parse did succeed */
 
-    /* if there was no '/' don't complain */
-    if (service->from_service->name[i] != '/')
-	return (TRUE);
+	/*
+	 * if service->name is "samba", and service->from_service->name is "daemon/samba" 
+	 * we have to update service->name.
+	 * also notice that service->name should not exactly match service->from_service->name, 
+	 * service->name might be "eth0" and service->from_service->name might be "net / *".
+	 */
+
+	/* cont the tokens to the first '/' */
+	while (service->from_service->name[i]
+		   && service->from_service->name[i] != '/')
+		i++;
 
-    /* compare the first i chars */
-    if (strncmp(service->from_service->name, service->name, i) != 0)
-    {
-	D_("Name %s ..\n", service->name);
-	char *new_name = (char *) i_calloc(strlen(service->name) + i + 3,
-					   sizeof(char));
-
-	strncpy(new_name, service->from_service->name, i + 1);
-	strcat(new_name, service->name);
-	free(service->name);
-	service->name = new_name;
-	D_(" Is now: %s \n", service->name);
-    }
+	/* if there was no '/' don't complain */
+	if (service->from_service->name[i] != '/')
+		return (TRUE);
+
+	/* compare the first i chars */
+	if (strncmp(service->from_service->name, service->name, i) != 0)
+	{
+		D_("Name %s ..\n", service->name);
+		char *new_name = (char *) i_calloc(strlen(service->name) + i + 3,
+										   sizeof(char));
+
+		strncpy(new_name, service->from_service->name, i + 1);
+		strcat(new_name, service->name);
+		free(service->name);
+		service->name = new_name;
+		D_(" Is now: %s \n", service->name);
+	}
 
-    /* return happily */
-    return (TRUE);
+	/* return happily */
+	return (TRUE);
 
 }
 
@@ -265,20 +265,20 @@
  */
 static void dep_failed_to_start(active_db_h * service)
 {
-    /* TODO, find a way to handle this */
+	/* TODO, find a way to handle this */
 #ifdef NONO
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
+
+	/* walk over all services */
+	while_active_db(current)
+	{
+		if (current == service)
+			continue;
 
-    /* walk over all services */
-    while_active_db(current)
-    {
-	if (current == service)
-	    continue;
-
-	/* if current depends on service failed to start */
-	if (initng_depend(current, service) == TRUE)
-	    initng_common_mark_service(current, &START_DEP_FAILED);
-    }
+		/* if current depends on service failed to start */
+		if (initng_depend(current, service) == TRUE)
+			initng_common_mark_service(current, &START_DEP_FAILED);
+	}
 #endif
 }
 
@@ -289,80 +289,80 @@
  */
 static void dep_failed_to_stop(active_db_h * service)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* walk over all services */
-    while_active_db(current)
-    {
-	if (current == service)
-	    continue;
-
-	/* if current depends on service failed to stop */
-	if (initng_active_db_dep_on(current, service) == TRUE)
-	    initng_common_mark_service(current, STOP_DEP_FAILED);
-    }
+	/* walk over all services */
+	while_active_db(current)
+	{
+		if (current == service)
+			continue;
+
+		/* if current depends on service failed to stop */
+		if (initng_active_db_dep_on(current, service) == TRUE)
+			initng_common_mark_service(current, STOP_DEP_FAILED);
+	}
 }
 #endif
 
 static void check_sys_state_up(void)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* If system is not starting, we have nothing to set. */
-    if (g.sys_state != STATE_STARTING)
-	return;
-
-    /* check actives, if any has one of these status, system cant be set to STATE_UP */
-    while_active_db(current)
-    {
-	if (IS_STARTING(current))
-	    return;
-    }
+	/* If system is not starting, we have nothing to set. */
+	if (g.sys_state != STATE_STARTING)
+		return;
 
-    /* OK, system is up */
-    initng_main_set_sys_state(STATE_UP);
+	/* check actives, if any has one of these status, system cant be set to STATE_UP */
+	while_active_db(current)
+	{
+		if (IS_STARTING(current))
+			return;
+	}
+
+	/* OK, system is up */
+	initng_main_set_sys_state(STATE_UP);
 }
 
 
 service_cache_h *initng_common_parse_service(const char *name)
 {
-    s_call *current, *safe = NULL;
-    service_cache_h *service = NULL;
-
-    /* first check service cache */
-    service = initng_service_cache_find_by_name(name);
-    if (service)
-	return (service);
-
-    /* try parse with dynamic loaded parsers */
-    while_list_safe(current, &g.PARSERS, safe)
-    {
-	service = ((*current->c.parser) (name));
+	s_call *current, *safe = NULL;
+	service_cache_h *service = NULL;
 
-	/* break if we found the service */
+	/* first check service cache */
+	service = initng_service_cache_find_by_name(name);
 	if (service)
-	    break;
+		return (service);
 
-    }
+	/* try parse with dynamic loaded parsers */
+	while_list_safe(current, &g.PARSERS, safe)
+	{
+		service = ((*current->c.parser) (name));
 
-    /* look so we actually got one */
-    if (!service)
-	return (NULL);
+		/* break if we found the service */
+		if (service)
+			break;
+
+	}
 
-    /* May be there is plug-ins that will parse extra data */
-    current = NULL;
-    safe = NULL;
-    while_list_safe(current, &g.ADDITIONAL_PARSE, safe)
-    {
-	if (((*current->c.additional_parse) (service)) != TRUE)
+	/* look so we actually got one */
+	if (!service)
+		return (NULL);
+
+	/* May be there is plug-ins that will parse extra data */
+	current = NULL;
+	safe = NULL;
+	while_list_safe(current, &g.ADDITIONAL_PARSE, safe)
 	{
-	    initng_service_cache_free(service);
-	    return (NULL);
+		if (((*current->c.additional_parse) (service)) != TRUE)
+		{
+			initng_service_cache_free(service);
+			return (NULL);
+		}
 	}
-    }
 
-    /* return the service */
-    return (service);
+	/* return the service */
+	return (service);
 }
 
 /*
@@ -373,123 +373,123 @@
  */
 int initng_common_mark_service(active_db_h * service, a_state_h * state)
 {
-    s_call *current, *q = NULL;
+	s_call *current, *q = NULL;
 
-    assert(service);
-    assert(service->name);
-    assert(service->current_state);
-    assert(state);
-
-    D_("going to mark_service(%s) from %s to %s\n", service->name,
-       service->current_state->state_name, state->state_name);
-
-    /* 1: Test if already set */
-    if (service->current_state == state)
-    {
-	D_("warning, this state %s is already set on %s!\n",
-	   state->state_name, service->name);
-	/* it is actually already set to requested state */
-	return (TRUE);
-    }
+	assert(service);
+	assert(service->name);
+	assert(service->current_state);
+	assert(state);
 
+	D_("going to mark_service(%s) from %s to %s\n", service->name,
+	   service->current_state->state_name, state->state_name);
 
-    /* Set INTERRUPT, the interrupt is set only when a service
-     * changes state, and all state handlers will be called
-     */
-    initng_global_set_interrupt();
-
-    /* Fill last entries */
-    service->last_state = service->current_state;
-    memcpy(&service->time_last_state, &service->time_current_state,
-	   sizeof(struct timeval));
-
-    /* update rough last to */
-    if (service->last_rought_state != service->current_state->is)
-    {
-	service->last_rought_state = service->current_state->is;
-	memcpy(&service->last_rought_time, &service->time_current_state,
-	       sizeof(memcpy));
-    }
-
-    /* reset alarm, set state and time */
-    service->alarm = 0;
-    service->current_state = state;
-    gettimeofday(&service->time_current_state, NULL);
-
-
-    /* call all hooks again, to notify about the change */
-    current = q = NULL;
-    while_list_safe(current, &g.ASTATUS_CHANGE, q)
-    {
-	if ((*current->c.status_change) (service) <= FALSE)
-	{
-	    D_("Some plugin return FALSE when service %s Astate_CHANGE to %s hook called, aborting here.\n", service->name, service->current_state->state_name);
-	    return (FALSE);
-	}
-
-	/* make sure that state was not changed again, because then, dont call more hooks */
-	if (service->current_state != state)
-	    return (TRUE);
-    }
-
-
-    /* If the rough state has changed */
-    if (service->last_rought_state != state->is)
-    {
-	D_("An is change from %i to %i for %s.\n", service->last_rought_state,
-	   state->is, service->name);
-	current = q = NULL;
-	while_list_safe(current, &g.IS_CHANGE, q)
+	/* 1: Test if already set */
+	if (service->current_state == state)
 	{
-	    if ((*current->c.status_change) (service) <= FALSE)
-	    {
-		D_("Some plugin return FALSE when service %s IS_CHANGE to %s hook called, aborting here.\n", service->name, service->current_state->state_name);
-		return (FALSE);
-	    }
-
-	    /* make sure that state was not changed again, because then, dont call more hooks */
-	    if (service->current_state != state)
+		D_("warning, this state %s is already set on %s!\n",
+		   state->state_name, service->name);
+		/* it is actually already set to requested state */
 		return (TRUE);
 	}
 
-	/* This checks if all services on a runlevel is up, then set STATE_UP */
-	if (IS_UP(service))
-	    check_sys_state_up();
 
-	/* this will make all services, that depend of this, DEP_FAILED_TO_START */
-	if (IS_FAILED(service))
+	/* Set INTERRUPT, the interrupt is set only when a service
+	 * changes state, and all state handlers will be called
+	 */
+	initng_global_set_interrupt();
+
+	/* Fill last entries */
+	service->last_state = service->current_state;
+	memcpy(&service->time_last_state, &service->time_current_state,
+		   sizeof(struct timeval));
+
+	/* update rough last to */
+	if (service->last_rought_state != service->current_state->is)
 	{
-	    dep_failed_to_start(service);
-	    check_sys_state_up();
+		service->last_rought_state = service->current_state->is;
+		memcpy(&service->last_rought_time, &service->time_current_state,
+			   sizeof(memcpy));
 	}
 
-	/* if this service is marked restarting, please restart it if its set to STOPPED */
-	if (IS_DOWN(service))
+	/* reset alarm, set state and time */
+	service->alarm = 0;
+	service->current_state = state;
+	gettimeofday(&service->time_current_state, NULL);
+
+
+	/* call all hooks again, to notify about the change */
+	current = q = NULL;
+	while_list_safe(current, &g.ASTATUS_CHANGE, q)
 	{
-	    if (is(&RESTARTING, service))
-	    {
-		initng_handler_restart_restarting();
-	    }
+		if ((*current->c.status_change) (service) <= FALSE)
+		{
+			D_("Some plugin return FALSE when service %s Astate_CHANGE to %s hook called, aborting here.\n", service->name, service->current_state->state_name);
+			return (FALSE);
+		}
+
+		/* make sure that state was not changed again, because then, dont call more hooks */
+		if (service->current_state != state)
+			return (TRUE);
 	}
-	/* this will make all services, that depend of this to stop, DEP_FAILED_TO_STOP */
-	/* TODO
-	   if (IS_MARK(service, &FAIL_STOPPING))
-	   {
-	   #ifdef DEP_FAIL_TO_STOP
-	   dep_failed_to_stop(service);
-	   #endif
-	   check_sys_state_up();
-	   }
-	 */
 
-    }
 
+	/* If the rough state has changed */
+	if (service->last_rought_state != state->is)
+	{
+		D_("An is change from %i to %i for %s.\n", service->last_rought_state,
+		   state->is, service->name);
+		current = q = NULL;
+		while_list_safe(current, &g.IS_CHANGE, q)
+		{
+			if ((*current->c.status_change) (service) <= FALSE)
+			{
+				D_("Some plugin return FALSE when service %s IS_CHANGE to %s hook called, aborting here.\n", service->name, service->current_state->state_name);
+				return (FALSE);
+			}
+
+			/* make sure that state was not changed again, because then, dont call more hooks */
+			if (service->current_state != state)
+				return (TRUE);
+		}
+
+		/* This checks if all services on a runlevel is up, then set STATE_UP */
+		if (IS_UP(service))
+			check_sys_state_up();
+
+		/* this will make all services, that depend of this, DEP_FAILED_TO_START */
+		if (IS_FAILED(service))
+		{
+			dep_failed_to_start(service);
+			check_sys_state_up();
+		}
+
+		/* if this service is marked restarting, please restart it if its set to STOPPED */
+		if (IS_DOWN(service))
+		{
+			if (is(&RESTARTING, service))
+			{
+				initng_handler_restart_restarting();
+			}
+		}
+		/* this will make all services, that depend of this to stop, DEP_FAILED_TO_STOP */
+		/* TODO
+		   if (IS_MARK(service, &FAIL_STOPPING))
+		   {
+		   #ifdef DEP_FAIL_TO_STOP
+		   dep_failed_to_stop(service);
+		   #endif
+		   check_sys_state_up();
+		   }
+		 */
+
+	}
 
-    /* Run state init hook if present */
-    if (service->current_state->state_init)
-	(*service->current_state->state_init) (service);
 
-    D_("service %s is now %s.\n", service->name,
-       service->current_state->state_name);
-    return (TRUE);
+	/* Run state init hook if present */
+	if (service->current_state->state_init)
+		(*service->current_state->state_init) (service);
+
+	D_("service %s is now %s.\n", service->name,
+	   service->current_state->state_name);
+	return (TRUE);
 }

Modified: initng/trunk/src/initng_control_command.c
==============================================================================
--- initng/trunk/src/initng_control_command.c	(original)
+++ initng/trunk/src/initng_control_command.c	Wed Apr  5 23:11:19 2006
@@ -31,119 +31,119 @@
 /* this adds a command to the global command struct */
 int initng_command_add(s_command * cmd)
 {
-    s_command *current = NULL;
+	s_command *current = NULL;
 
-    assert(cmd);
+	assert(cmd);
 
-    /* look for duplicates */
-    while_command_db(current)
-    {
-	if (current == cmd || current->command_id == cmd->command_id)
+	/* look for duplicates */
+	while_command_db(current)
 	{
-	    F_("Can't add command: %c, %s, it exists already!\n",
-	       current->command_id, current->description);
-	    return (FALSE);
+		if (current == cmd || current->command_id == cmd->command_id)
+		{
+			F_("Can't add command: %c, %s, it exists already!\n",
+			   current->command_id, current->description);
+			return (FALSE);
+		}
 	}
-    }
 
-    /* add this command to list */
-    list_add(&cmd->list, &g.command_db.list);
-    return (TRUE);
+	/* add this command to list */
+	list_add(&cmd->list, &g.command_db.list);
+	return (TRUE);
 }
 
 void initng_command_free_all(void)
 {
-    s_command *current, *safe = NULL;
+	s_command *current, *safe = NULL;
 
-    while_command_db_safe(current, safe)
-    {
-	initng_command_del(current);
-    }
+	while_command_db_safe(current, safe)
+	{
+		initng_command_del(current);
+	}
 }
 
 /* look for a command by command_id */
 s_command *initng_command_find_by_command_id(char cid)
 {
-    s_command *current = NULL;
+	s_command *current = NULL;
 
-    while_command_db(current)
-    {
-	if (current->command_id == cid)
-	    return (current);
-    }
-    return (NULL);
+	while_command_db(current)
+	{
+		if (current->command_id == cid)
+			return (current);
+	}
+	return (NULL);
 }
 
 /* look for a command by command_id */
 s_command *initng_command_find_by_command_string(char *name)
 {
-    s_command *current = NULL;
+	s_command *current = NULL;
 
-    while_command_db(current)
-    {
-	if (current->long_id && strcmp(current->long_id, name) == 0)
-	    return (current);
-    }
-    return (NULL);
+	while_command_db(current)
+	{
+		if (current->long_id && strcmp(current->long_id, name) == 0)
+			return (current);
+	}
+	return (NULL);
 }
 
 int initng_command_execute_arg(char cid, char *arg)
 {
-    /* use function about to search it */
-    s_command *cmd = initng_command_find_by_command_id(cid);
+	/* use function about to search it */
+	s_command *cmd = initng_command_find_by_command_id(cid);
+
+	/* make sure it found it. */
+	if (!cmd)
+	{
+		D_("Did not find command %c.\n", cid);
+		return (FALSE);
+	}
+
+	/* check so its a INT_COMMAND */
+	if (cmd->com_type != INT_COMMAND && cmd->com_type != VOID_COMMAND
+		&& cmd->com_type != TRUE_OR_FALSE_COMMAND)
+	{
+		W_("Command %c is not an INT_COMMAND, VOID_COMMAND or TRUE_OR_FALSE_COMMAND.\n", cid);
+		return (FALSE);
+	}
+
+	/* Check so the call is actually there */
+
+	if (!cmd->u.int_command_void_call)
+	{
+		W_("Command %c missing u.int_command_call or u.int_command_void_call.\n", cid);
+		return (FALSE);
+	}
+
+
+	/* check with arguments */
+	if (!arg && cmd->opt_type == REQUIRES_OPT)
+	{
+		F_("Command %c needs an opt!\n", cid);
+		return (FALSE);
+	}
+	if (arg && cmd->opt_type == NO_OPT)
+	{
+		F_("Command %c don't uses any options!\n", cid);
+		return (FALSE);
+	}
+
+	/* now start executing */
+	if (cmd->com_type == INT_COMMAND
+		|| cmd->com_type == TRUE_OR_FALSE_COMMAND)
+	{
+		/* execute the command */
+		if (arg)
+			return ((*cmd->u.int_command_call) (arg));
+		/* else */
+		return ((*cmd->u.int_command_void_call) ());
+	}
 
-    /* make sure it found it. */
-    if (!cmd)
-    {
-	D_("Did not find command %c.\n", cid);
-	return (FALSE);
-    }
-
-    /* check so its a INT_COMMAND */
-    if (cmd->com_type != INT_COMMAND && cmd->com_type != VOID_COMMAND
-	&& cmd->com_type != TRUE_OR_FALSE_COMMAND)
-    {
-	W_("Command %c is not an INT_COMMAND, VOID_COMMAND or TRUE_OR_FALSE_COMMAND.\n", cid);
-	return (FALSE);
-    }
-
-    /* Check so the call is actually there */
-
-    if (!cmd->u.int_command_void_call)
-    {
-	W_("Command %c missing u.int_command_call or u.int_command_void_call.\n", cid);
-	return (FALSE);
-    }
-
-
-    /* check with arguments */
-    if (!arg && cmd->opt_type == REQUIRES_OPT)
-    {
-	F_("Command %c needs an opt!\n", cid);
-	return (FALSE);
-    }
-    if (arg && cmd->opt_type == NO_OPT)
-    {
-	F_("Command %c don't uses any options!\n", cid);
-	return (FALSE);
-    }
-
-    /* now start executing */
-    if (cmd->com_type == INT_COMMAND
-	|| cmd->com_type == TRUE_OR_FALSE_COMMAND)
-    {
+	/* else its a VOID command, that wont give us any to return. */
 	/* execute the command */
 	if (arg)
-	    return ((*cmd->u.int_command_call) (arg));
-	/* else */
-	return ((*cmd->u.int_command_void_call) ());
-    }
-
-    /* else its a VOID command, that wont give us any to return. */
-    /* execute the command */
-    if (arg)
-	(*cmd->u.void_command_call) (arg);
-    else
-	(*cmd->u.void_command_void_call) ();
-    return (TRUE);
+		(*cmd->u.void_command_call) (arg);
+	else
+		(*cmd->u.void_command_void_call) ();
+	return (TRUE);
 }

Modified: initng/trunk/src/initng_control_command.h
==============================================================================
--- initng/trunk/src/initng_control_command.h	(original)
+++ initng/trunk/src/initng_control_command.h	Wed Apr  5 23:11:19 2006
@@ -29,17 +29,17 @@
  */
 typedef enum
 {
-    COMMAND_FAIL = 0,
-    PAYLOAD_COMMAND = 1,
-    VOID_COMMAND = 2,
-    INT_COMMAND = 3,
-    TRUE_OR_FALSE_COMMAND = 4,
-    STRING_COMMAND = 5,
-
-    /* data commands, contains a lot of entrys in binary structs below */
-    DATA_COMMANDS_ROW = 6,		    /* help_row, lists a command */
-    DATA_ACTIVE_ROW = 7,		    /* active_row, list a service */
-    DATA_OPTION_ROW = 8,		    /* list variables that may be set */
+	COMMAND_FAIL = 0,
+	PAYLOAD_COMMAND = 1,
+	VOID_COMMAND = 2,
+	INT_COMMAND = 3,
+	TRUE_OR_FALSE_COMMAND = 4,
+	STRING_COMMAND = 5,
+
+	/* data commands, contains a lot of entrys in binary structs below */
+	DATA_COMMANDS_ROW = 6,					/* help_row, lists a command */
+	DATA_ACTIVE_ROW = 7,					/* active_row, list a service */
+	DATA_OPTION_ROW = 8,					/* list variables that may be set */
 } e_com_type;
 
 /*
@@ -48,10 +48,10 @@
  */
 typedef enum
 {
-    STANDARD_COMMAND = 0,	/* shown by ngc -h */
-    ADVANCHED_COMMAND = 1,		    /* shown by ngc -H */
-    HIDDEN_COMMAND = 2,			    /* not shown by ngc -h/-H but still usable */
-    INTERNAL_COMMAND = 3		    /* not shown or usable externaly */
+	STANDARD_COMMAND = 0,		/* shown by ngc -h */
+	ADVANCHED_COMMAND = 1,					/* shown by ngc -H */
+	HIDDEN_COMMAND = 2,						/* not shown by ngc -h/-H but still usable */
+	INTERNAL_COMMAND = 3					/* not shown or usable externaly */
 } e_opt_vissible;
 
 /*
@@ -59,9 +59,9 @@
  */
 typedef enum
 {
-    NO_OPT = 0,			/* Command uses no option ever */
-    USES_OPT = 1,			    /* Command uses an option if sent */
-    REQUIRES_OPT = 2			    /* Command requires an option set */
+	NO_OPT = 0,					/* Command uses no option ever */
+	USES_OPT = 1,							/* Command uses an option if sent */
+	REQUIRES_OPT = 2						/* Command requires an option set */
 } e_opt_type;
 
 
@@ -72,8 +72,8 @@
  */
 typedef struct
 {
-    size_t s;
-    void *p;
+	size_t s;
+	void *p;
 } s_payload;
 
 
@@ -82,36 +82,36 @@
  */
 typedef struct
 {
-    char command_id;		/* An short char describes a command, like ngc -h */
-    const char *long_id;	/* An long string, describes a command, like ngc --help */
-    e_com_type com_type;	/* Specify how data command returns looks like */
-    e_opt_vissible opt_vissible;	/* Specifys how accesible the command is for the end user */
-    e_opt_type opt_type;	/* Is an option required to the command */
-
-    /*
-     * Here we put a pointer to a function,
-     * that is the command we call
-     */
-    union
-    {
-	void (*void_command_call) (void *data);
-	void (*void_command_void_call) (void);
-	int (*int_command_call) (void *data);
-	int (*int_command_void_call) (void);
-	char *(*string_command_call) (void *data);
-	char *(*string_command_void_call) (void);
-	void (*data_command_call) (char *data, s_payload * payload);
-    } u;
-
-    /*
-     * An string, with an descripton of what this command is for.
-     * This is used for ngc -h, to describe the commands.
-     * It may be null.
-     */
-    const char *description;
+	char command_id;			/* An short char describes a command, like ngc -h */
+	const char *long_id;		/* An long string, describes a command, like ngc --help */
+	e_com_type com_type;		/* Specify how data command returns looks like */
+	e_opt_vissible opt_vissible;	/* Specifys how accesible the command is for the end user */
+	e_opt_type opt_type;		/* Is an option required to the command */
+
+	/*
+	 * Here we put a pointer to a function,
+	 * that is the command we call
+	 */
+	union
+	{
+		void (*void_command_call) (void *data);
+		void (*void_command_void_call) (void);
+		int (*int_command_call) (void *data);
+		int (*int_command_void_call) (void);
+		char *(*string_command_call) (void *data);
+		char *(*string_command_void_call) (void);
+		void (*data_command_call) (char *data, s_payload * payload);
+	} u;
+
+	/*
+	 * An string, with an descripton of what this command is for.
+	 * This is used for ngc -h, to describe the commands.
+	 * It may be null.
+	 */
+	const char *description;
 
-    /* Reserved for initng */
-    struct list_head list;
+	/* Reserved for initng */
+	struct list_head list;
 } s_command;
 
 int initng_command_add(s_command * cmd);

Modified: initng/trunk/src/initng_depend.c
==============================================================================
--- initng/trunk/src/initng_depend.c	(original)
+++ initng/trunk/src/initng_depend.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 
 
 #include <stdio.h>
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <string.h>
 #include <assert.h>
 
@@ -45,28 +45,28 @@
  */
 int initng_depend(active_db_h * service, active_db_h * check)
 {
-    s_call *current, *s = NULL;
-    int result = FALSE;
+	s_call *current, *s = NULL;
+	int result = FALSE;
 
-    assert(service);
-    assert(check);
+	assert(service);
+	assert(check);
 
-    /* it can never depend on itself */
-    if (service == check)
-	return (FALSE);
+	/* it can never depend on itself */
+	if (service == check)
+		return (FALSE);
 
-    /* run the local static dep check */
-    if (dep_on(service, check) == TRUE)
-	return (TRUE);
+	/* run the local static dep check */
+	if (dep_on(service, check) == TRUE)
+		return (TRUE);
 
-    /* run the global plugin dep check */
-    while_list_safe(current, &g.DEP_ON, s)
-    {
-	if ((result = (*current->c.dep_on_check) (service, check) == TRUE))
-	    return (TRUE);
-    }
+	/* run the global plugin dep check */
+	while_list_safe(current, &g.DEP_ON, s)
+	{
+		if ((result = (*current->c.dep_on_check) (service, check) == TRUE))
+			return (TRUE);
+	}
 
-    return (FALSE);
+	return (FALSE);
 }
 
 /*
@@ -78,44 +78,44 @@
  * Summary, does service depends on check?
  */
 static int initng_depend_deep2(active_db_h * service, active_db_h * check,
-			       int *stack);
+							   int *stack);
 int initng_depend_deep(active_db_h * service, active_db_h * check)
 {
-    int stack = 0;
+	int stack = 0;
 
-    return (initng_depend_deep2(service, check, &stack));
+	return (initng_depend_deep2(service, check, &stack));
 }
 
 static int initng_depend_deep2(active_db_h * service, active_db_h * check,
-			       int *stack)
+							   int *stack)
 {
-    active_db_h *current = NULL;
-    int result = FALSE;
+	active_db_h *current = NULL;
+	int result = FALSE;
 
-    if (current == service)
-	return (FALSE);
+	if (current == service)
+		return (FALSE);
 
-    /* if service depends on check, it also dep_on_deep's on check */
-    /* this serves as an exit from the recursion */
-    if (initng_depend(service, check))
-	return (TRUE);
+	/* if service depends on check, it also dep_on_deep's on check */
+	/* this serves as an exit from the recursion */
+	if (initng_depend(service, check))
+		return (TRUE);
 
-    /* in case there is a circular dependency, break after 10 levels of recursion */
-    (*stack)++;
-    if (*stack > 10)
-	return (FALSE);
+	/* in case there is a circular dependency, break after 10 levels of recursion */
+	(*stack)++;
+	if (*stack > 10)
+		return (FALSE);
 
-    /* loop over all services, if service depends on current, recursively check if
-     * current may depend (deep) on check */
-    while_active_db(current)
-    {
-	if (initng_depend(service, current))
+	/* loop over all services, if service depends on current, recursively check if
+	 * current may depend (deep) on check */
+	while_active_db(current)
 	{
-	    if ((result = initng_depend_deep2(current, check, stack)))
-		break;
+		if (initng_depend(service, current))
+		{
+			if ((result = initng_depend_deep2(current, check, stack)))
+				break;
+		}
 	}
-    }
-    return result;
+	return result;
 }
 
 /* check if any service in list, that is starting, running, or stopping
@@ -124,99 +124,99 @@
  */
 int initng_any_depends_on(active_db_h * service)
 {
-    active_db_h *current = NULL;
-
-    printf("initng_any_depends_on(%s);\n", service->name);
+	active_db_h *current = NULL;
 
-    while_active_db(current)
-    {
-	/* Dont mind stop itself */
-	if (current == service)
-	    continue;
+	printf("initng_any_depends_on(%s);\n", service->name);
 
-	if (IS_UP(current) || IS_STARTING(current) || IS_STOPPING(current))
+	while_active_db(current)
 	{
+		/* Dont mind stop itself */
+		if (current == service)
+			continue;
 
-	    /* if current depends on service */
-	    if (initng_depend_deep(current, service) == TRUE)
-	    {
-		printf("Service %s depends on %s\n", current->name,
-		       service->name);
-		return (TRUE);
-	    }
+		if (IS_UP(current) || IS_STARTING(current) || IS_STOPPING(current))
+		{
+
+			/* if current depends on service */
+			if (initng_depend_deep(current, service) == TRUE)
+			{
+				printf("Service %s depends on %s\n", current->name,
+					   service->name);
+				return (TRUE);
+			}
+		}
 	}
-    }
-    printf("None found depending on %s.\n", service->name);
-    return (FALSE);
+	printf("None found depending on %s.\n", service->name);
+	return (FALSE);
 }
 
 /* standard dep check */
 static int dep_on(active_db_h * service, active_db_h * check)
 {
-    const char *string = NULL;
-    s_data *current = NULL;
+	const char *string = NULL;
+	s_data *current = NULL;
 
-    assert(service);
-    assert(check);
+	assert(service);
+	assert(check);
 
-    while ((string = get_next_string(&REQUIRE, service, &current)))
-    {
-	if (strcmp(string, check->name) == 0)
-	    return (TRUE);
-    }
-    current = NULL;
-    while ((string = get_next_string(&NEED, service, &current)))
-    {
-	if (strcmp(string, check->name) == 0)
-	    return (TRUE);
-    }
-    current = NULL;
-    while ((string = get_next_string(&USE, service, &current)))
-    {
-	if (strcmp(string, check->name) == 0)
-	    return (TRUE);
-    }
-    return (FALSE);
+	while ((string = get_next_string(&REQUIRE, service, &current)))
+	{
+		if (strcmp(string, check->name) == 0)
+			return (TRUE);
+	}
+	current = NULL;
+	while ((string = get_next_string(&NEED, service, &current)))
+	{
+		if (strcmp(string, check->name) == 0)
+			return (TRUE);
+	}
+	current = NULL;
+	while ((string = get_next_string(&USE, service, &current)))
+	{
+		if (strcmp(string, check->name) == 0)
+			return (TRUE);
+	}
+	return (FALSE);
 }
 
 int initng_depend_stop_deps(active_db_h * service)
 {
-    active_db_h *current = NULL;
-    active_db_h *safe = NULL;
-
-    /* also stop all service depending on service_to_stop */
-    while_active_db_safe(current, safe)
-    {
-	/* Dont mind stop itself */
-	if (current == service)
-	    continue;
+	active_db_h *current = NULL;
+	active_db_h *safe = NULL;
 
-	/* if current depends on the one we are stopping */
-	if (initng_depend_deep(current, service) == TRUE)
-	    initng_handler_stop_service(current);
-    }
+	/* also stop all service depending on service_to_stop */
+	while_active_db_safe(current, safe)
+	{
+		/* Dont mind stop itself */
+		if (current == service)
+			continue;
+
+		/* if current depends on the one we are stopping */
+		if (initng_depend_deep(current, service) == TRUE)
+			initng_handler_stop_service(current);
+	}
 
-    return (TRUE);
+	return (TRUE);
 }
 
 int initng_depend_restart_deps(active_db_h * service)
 {
-    active_db_h *current = NULL;
-    active_db_h *safe = NULL;
+	active_db_h *current = NULL;
+	active_db_h *safe = NULL;
 
-    /* also stop all service depending on service_to_stop */
-    while_active_db_safe(current, safe)
-    {
-	/* Dont mind stop itself */
-	if (current == service)
-	    continue;
-
-	/* if current depends on the one we are stopping */
-	if (initng_depend_deep(current, service) == TRUE)
-	    initng_handler_restart_service(current);
-    }
+	/* also stop all service depending on service_to_stop */
+	while_active_db_safe(current, safe)
+	{
+		/* Dont mind stop itself */
+		if (current == service)
+			continue;
+
+		/* if current depends on the one we are stopping */
+		if (initng_depend_deep(current, service) == TRUE)
+			initng_handler_restart_service(current);
+	}
 
-    return (TRUE);
+	return (TRUE);
 }
 
 
@@ -225,20 +225,20 @@
  */
 int initng_depend_up_check(active_db_h * service)
 {
-    s_call *current, *s = NULL;
-    int ret;
+	s_call *current, *s = NULL;
+	int ret;
 
-    /* run the global plugin dep check */
-    while_list_safe(current, &g.UP_MET, s)
-    {
+	/* run the global plugin dep check */
+	while_list_safe(current, &g.UP_MET, s)
+	{
 
-	if ((ret = (*current->c.up_met) (service)) < TRUE)
-	    return (ret);
+		if ((ret = (*current->c.up_met) (service)) < TRUE)
+			return (ret);
 
-    }
+	}
 
-    /* Return happily */
-    return (TRUE);
+	/* Return happily */
+	return (TRUE);
 
 }
 
@@ -249,98 +249,98 @@
  */
 int initng_depend_start_dep_met(active_db_h * service, int verbose)
 {
-    s_call *current, *s = NULL;
-    active_db_h *currentA = NULL;
-    int ret;
-    int i = 0;
-
-
-    /* only do this check if it has not been done before */
-    if (service->depend_cache == 0)
-    {
-
-	/*
-	 *    Check so all deps, that needs service, is up.
-	 */
-	while_active_db(currentA)
-	{
-	    if (currentA == service)
-		continue;
-
-	    /* if current is not one that it depends on continue */
-	    if (initng_depend(service, currentA) == FALSE)
-		continue;
-
-	    /* If this service depends on me, it wont wait for it */
-	    /* This is EXPRIMENTAL */
-	    if (initng_depend(currentA, service) == TRUE)
-		continue;
-
-
-	    /* if service dep on is starting, wait a bit */
-	    if (IS_STARTING(currentA))
-	    {
-		if (verbose)
-		{
-		    F_("Could not start service %s because it depends on service %s that is still starting.\n", service->name, currentA->name);
-		}
-		return (FALSE);
-	    }
+	s_call *current, *s = NULL;
+	active_db_h *currentA = NULL;
+	int ret;
+	int i = 0;
 
-	    /* if service failed, return that */
-	    if (IS_FAILED(currentA))
-	    {
-		if (verbose)
+
+	/* only do this check if it has not been done before */
+	if (service->depend_cache == 0)
+	{
+
+		/*
+		 *    Check so all deps, that needs service, is up.
+		 */
+		while_active_db(currentA)
 		{
-		    F_("Could not start service %s because it depends on service %s that is failed.\n", service->name, currentA->name);
-		}
-		return (FAIL);
-	    }
+			if (currentA == service)
+				continue;
 
-	    /* if its marked down, and not starting, start it */
-	    if (IS_DOWN(currentA))
-	    {
-		initng_handler_start_service(currentA);
-		return (FALSE);
-	    }
+			/* if current is not one that it depends on continue */
+			if (initng_depend(service, currentA) == FALSE)
+				continue;
+
+			/* If this service depends on me, it wont wait for it */
+			/* This is EXPRIMENTAL */
+			if (initng_depend(currentA, service) == TRUE)
+				continue;
+
+
+			/* if service dep on is starting, wait a bit */
+			if (IS_STARTING(currentA))
+			{
+				if (verbose)
+				{
+					F_("Could not start service %s because it depends on service %s that is still starting.\n", service->name, currentA->name);
+				}
+				return (FALSE);
+			}
+
+			/* if service failed, return that */
+			if (IS_FAILED(currentA))
+			{
+				if (verbose)
+				{
+					F_("Could not start service %s because it depends on service %s that is failed.\n", service->name, currentA->name);
+				}
+				return (FAIL);
+			}
+
+			/* if its marked down, and not starting, start it */
+			if (IS_DOWN(currentA))
+			{
+				initng_handler_start_service(currentA);
+				return (FALSE);
+			}
+
+			/* if its not starting or up, return FAIL */
+			if (!IS_UP(currentA))
+			{
+				F_("Could not start service %s because it depends on service %s has state %s\n", service->name, currentA->name, currentA->current_state->state_name);
+				return (FALSE);
+			}
+		}
 
-	    /* if its not starting or up, return FAIL */
-	    if (!IS_UP(currentA))
-	    {
-		F_("Could not start service %s because it depends on service %s has state %s\n", service->name, currentA->name, currentA->current_state->state_name);
-		return (FALSE);
-	    }
+		service->depend_cache++;
 	}
 
-	service->depend_cache++;
-    }
 
+	/* run the global plugin dep check */
+	while_list_safe(current, &g.START_DEP_MET, s)
+	{
+		/* This is check number i */
+		i++;
 
-    /* run the global plugin dep check */
-    while_list_safe(current, &g.START_DEP_MET, s)
-    {
-	/* This is check number i */
-	i++;
+		/* Only run this check if it has not been run before */
+		if (service->depend_cache > i)
+			continue;
 
-	/* Only run this check if it has not been run before */
-	if (service->depend_cache > i)
-	    continue;
+		if ((ret = (*current->c.start_dep_met) (service)) < TRUE)
+		{
+			if (verbose)
+			{
+				F_("Service %s can not be started because a plugin (START_DEP_MET) says so.\n", service->name);
+			}
+			return (ret);
+		}
 
-	if ((ret = (*current->c.start_dep_met) (service)) < TRUE)
-	{
-	    if (verbose)
-	    {
-		F_("Service %s can not be started because a plugin (START_DEP_MET) says so.\n", service->name);
-	    }
-	    return (ret);
+		/* if this succeds, count up one, so test wont be run again */
+		service->depend_cache++;
 	}
 
-	/* if this succeds, count up one, so test wont be run again */
-	service->depend_cache++;
-    }
-
-    service->depend_cache = 0;
-    return (TRUE);
+	service->depend_cache = 0;
+	return (TRUE);
 }
 
 /*
@@ -350,90 +350,90 @@
  */
 int initng_depend_stop_dep_met(active_db_h * service, int verbose)
 {
-    s_call *current, *s = NULL;
-    active_db_h *currentA = NULL;
-    int ret;
-    int i = 0;
-
-
-    /* only do this check if it has not been done before */
-    if (service->depend_cache == 0)
-    {
-
-	/*
-	 *    Check so all deps, that needs service, is down.
-	 *    if there are services depending on this one still running, return false and still try
-	 */
-	while_active_db(currentA)
-	{
-	    if (currentA == service)
-		continue;
-
-	    /* Does service depends on current ?? */
-	    if (initng_depend(currentA, service) == FALSE)
-		continue;
-
-	    /* if its done, this is perfect */
-	    if (IS_DOWN(currentA))
-		continue;
-
-	    /* If the dep is failed, continue */
-	    if (IS_FAILED(currentA))
-		continue;
-
-	    /* BIG TODO.
-	     * This is not correct, but if we wait for a service that is
-	     * starting to stop, and that service is waiting for this service
-	     * to start, until it starts, makes a deadlock.
-	     * 
-	     * Asuming that STARTING services WAITING_FOR_START_DEP are down for now.
-	     */
-	    if (IS_STARTING(currentA)
-		&& strstr(currentA->current_state->state_name,
-			  "WAITING_FOR_START_DEP"))
-		continue;
-
-	    /* else RETURN */
-	    if (verbose)
-		D_("still waiting for service %s state %s\n", currentA->name,
-		   currentA->current_state->state_name);
-	    else
-		D_("still waiting for service %s state %s\n", currentA->name,
-		   currentA->current_state->state_name);
-
-	    if (IS_UP(currentA))
-		initng_handler_stop_service(currentA);
-
-	    return (FALSE);
-	}
-	service->depend_cache++;
-    }
-
-    /* run the global plugin dep check */
-    while_list_safe(current, &g.STOP_DEP_MET, s)
-    {
-	/* This is check number i */
-	i++;
-
-	/* This counts how many test thats have succeded before */
-	if (service->depend_cache > i)
-	    continue;
-
-	if ((ret = (*current->c.stop_dep_met) (service)) != TRUE)
-	{
-	    if (verbose)
-	    {
-		F_("Service %s can not be started because a plugin (START_DEP_MET) says so.\n", service->name);
-	    }
-	    return (FALSE);
-	}
-
-	/* count this check so it wont be run again */
-	service->depend_cache++;
-    }
+	s_call *current, *s = NULL;
+	active_db_h *currentA = NULL;
+	int ret;
+	int i = 0;
+
+
+	/* only do this check if it has not been done before */
+	if (service->depend_cache == 0)
+	{
+
+		/*
+		 *    Check so all deps, that needs service, is down.
+		 *    if there are services depending on this one still running, return false and still try
+		 */
+		while_active_db(currentA)
+		{
+			if (currentA == service)
+				continue;
+
+			/* Does service depends on current ?? */
+			if (initng_depend(currentA, service) == FALSE)
+				continue;
+
+			/* if its done, this is perfect */
+			if (IS_DOWN(currentA))
+				continue;
+
+			/* If the dep is failed, continue */
+			if (IS_FAILED(currentA))
+				continue;
+
+			/* BIG TODO.
+			 * This is not correct, but if we wait for a service that is
+			 * starting to stop, and that service is waiting for this service
+			 * to start, until it starts, makes a deadlock.
+			 * 
+			 * Asuming that STARTING services WAITING_FOR_START_DEP are down for now.
+			 */
+			if (IS_STARTING(currentA)
+				&& strstr(currentA->current_state->state_name,
+						  "WAITING_FOR_START_DEP"))
+				continue;
+
+			/* else RETURN */
+			if (verbose)
+				D_("still waiting for service %s state %s\n", currentA->name,
+				   currentA->current_state->state_name);
+			else
+				D_("still waiting for service %s state %s\n", currentA->name,
+				   currentA->current_state->state_name);
+
+			if (IS_UP(currentA))
+				initng_handler_stop_service(currentA);
+
+			return (FALSE);
+		}
+		service->depend_cache++;
+	}
 
-    service->depend_cache = 0;
-    return (TRUE);
+	/* run the global plugin dep check */
+	while_list_safe(current, &g.STOP_DEP_MET, s)
+	{
+		/* This is check number i */
+		i++;
+
+		/* This counts how many test thats have succeded before */
+		if (service->depend_cache > i)
+			continue;
+
+		if ((ret = (*current->c.stop_dep_met) (service)) != TRUE)
+		{
+			if (verbose)
+			{
+				F_("Service %s can not be started because a plugin (START_DEP_MET) says so.\n", service->name);
+			}
+			return (FALSE);
+		}
+
+		/* count this check so it wont be run again */
+		service->depend_cache++;
+	}
+
+	service->depend_cache = 0;
+	return (TRUE);
 }
 
 /*
@@ -442,59 +442,59 @@
  */
 int initng_depend_start_deps(active_db_h * service)
 {
-    const char *tmp = NULL;
-    active_db_h *dep = NULL;
-    s_data *current = NULL;
+	const char *tmp = NULL;
+	active_db_h *dep = NULL;
+	s_data *current = NULL;
 
-    assert(service);
-    assert(service->name);
+	assert(service);
+	assert(service->name);
 
-    /* TODO, make this one while loop, using active_db_get_next */
+	/* TODO, make this one while loop, using active_db_get_next */
 
-    while ((tmp = get_next_string(&REQUIRE, service, &current)))
-    {
-	/* look if it exits already */
-	if ((dep = initng_active_db_find_by_name(tmp)))
+	while ((tmp = get_next_string(&REQUIRE, service, &current)))
 	{
-	    /* start the service if its down */
-	    if (IS_DOWN(dep))
-		initng_handler_start_service(dep);
-	    D_("No need to LOAD %s, it is already loaded!\n", tmp);
-	    continue;
-	}
+		/* look if it exits already */
+		if ((dep = initng_active_db_find_by_name(tmp)))
+		{
+			/* start the service if its down */
+			if (IS_DOWN(dep))
+				initng_handler_start_service(dep);
+			D_("No need to LOAD %s, it is already loaded!\n", tmp);
+			continue;
+		}
 
-	/* OKAY, start the service */
+		/* OKAY, start the service */
 
-	if (!initng_handler_start_new_service_named(tmp))
-	{
-	    F_("%s required dep \"%s\" could not start!\n", service->name,
-	       tmp);
-	    initng_handler_stop_service(service);
-	    return (FALSE);
+		if (!initng_handler_start_new_service_named(tmp))
+		{
+			F_("%s required dep \"%s\" could not start!\n", service->name,
+			   tmp);
+			initng_handler_stop_service(service);
+			return (FALSE);
+		}
 	}
-    }
 
-    current = NULL;
-    while ((tmp = get_next_string(&NEED, service, &current)))
-    {
-	/* look if it exits already */
-	if ((dep = initng_active_db_find_by_name(tmp)))
+	current = NULL;
+	while ((tmp = get_next_string(&NEED, service, &current)))
 	{
-	    /* start service if down */
-	    if (IS_DOWN(dep))
-		initng_handler_start_service(dep);
-	    D_("No need to LOAD %s, it is already loaded!\n", tmp);
-	    continue;
-	}
+		/* look if it exits already */
+		if ((dep = initng_active_db_find_by_name(tmp)))
+		{
+			/* start service if down */
+			if (IS_DOWN(dep))
+				initng_handler_start_service(dep);
+			D_("No need to LOAD %s, it is already loaded!\n", tmp);
+			continue;
+		}
 
-	/* OKAY, start the service */
+		/* OKAY, start the service */
 
-	if (!initng_handler_start_new_service_named(tmp))
-	{
-	    W_("service \"%s\" needs service \"%s\", that could not be found!\n", service->name, tmp);
+		if (!initng_handler_start_new_service_named(tmp))
+		{
+			W_("service \"%s\" needs service \"%s\", that could not be found!\n", service->name, tmp);
+		}
 	}
-    }
 
 
-    return (TRUE);
+	return (TRUE);
 }

Modified: initng/trunk/src/initng_env_variable.c
==============================================================================
--- initng/trunk/src/initng_env_variable.c	(original)
+++ initng/trunk/src/initng_env_variable.c	Wed Apr  5 23:11:19 2006
@@ -22,17 +22,17 @@
 #include "initng.h"
 
 /* system headers */
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdio.h>			    /* printf() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdio.h>							/* printf() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <assert.h>
-#include <ctype.h>			    /* isgraph */
+#include <ctype.h>							/* isgraph */
 
 /* own header */
 #include "initng_env_variable.h"
@@ -50,16 +50,16 @@
 #include <initng-paths.h>
 
 const char *initng_environ[] = {
-    "INITNG=" INITNG_VERSION,
-    "INITNG_CREATOR=" INITNG_CREATOR,
-    "INIT_VERSION=" INITNG_VERSION,
-    "INITNG_PLUGIN_DIR=" INITNG_PLUGIN_DIR,
-    "INITNG_ROOT=" INITNG_ROOT,
-    "PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/opt/bin",
-    "HOME=/root",
-    "USER=root",
-    "TERM=linux",
-    NULL
+	"INITNG=" INITNG_VERSION,
+	"INITNG_CREATOR=" INITNG_CREATOR,
+	"INIT_VERSION=" INITNG_VERSION,
+	"INITNG_PLUGIN_DIR=" INITNG_PLUGIN_DIR,
+	"INITNG_ROOT=" INITNG_ROOT,
+	"PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/opt/bin",
+	"HOME=/root",
+	"USER=root",
+	"TERM=linux",
+	NULL
 };
 
 /* creates a custom set of environment variables, for passing to exec
@@ -69,173 +69,173 @@
  */
 char **new_environ(active_db_h * s)
 {
-    int allocate;
-    int nr = 0;
-    int i;
-    char **env;
-    char *var;
-
-    /* Better safe than sorry... */
-    if (s && s->name == NULL)
-	s->name = i_strdup("unknown");
-
-    /*
-     * FIRST, try to figure out how big array we want to create.
-     */
-
-    /*  At least 11 allocations below, and place for plugin added to (about 100) */
-    allocate = 114;
-
-    /* count existing env's */
-#ifdef USE_OLD_ENV			    /* DO NOT USE - BROKEN */
-    while (environ[nr])
-	allocate++;
-#endif
-
-    /* count ENVs in service ENV variable */
-    if (s)
-	allocate += count_type(&ENV, s);
+	int allocate;
+	int nr = 0;
+	int i;
+	char **env;
+	char *var;
+
+	/* Better safe than sorry... */
+	if (s && s->name == NULL)
+		s->name = i_strdup("unknown");
 
+	/*
+	 * FIRST, try to figure out how big array we want to create.
+	 */
 
-    /* finally allocate */
-    env = (char **) i_calloc(allocate, sizeof(char *));
+	/*  At least 11 allocations below, and place for plugin added to (about 100) */
+	allocate = 114;
 
-    /* duplicate */
-#ifdef USE_OLD_ENV
-    for (nr = 0; environ[nr] && nr < allocate; nr++)
-    {
-	env[nr] = i_strdup(environ[nr]);
-    }
+	/* count existing env's */
+#ifdef USE_OLD_ENV							/* DO NOT USE - BROKEN */
+	while (environ[nr])
+		allocate++;
 #endif
 
-    /* add all static defined above in initng_environ */
-    for (nr = 0; initng_environ[nr]; nr++)
-    {
-	env[nr] = i_strdup(initng_environ[nr]);
-    }
-
-
-    if (s && (nr + 4) < allocate)
-    {
-	env[nr] = (char *) i_calloc(1, sizeof(char) * (9 + strlen(s->name)));
-	strcpy(env[nr], "SERVICE=");
-	strcat(env[nr], s->name);
-	nr++;
-
-	env[nr] = (char *) i_calloc(1, sizeof(char) * (6 + strlen(s->name)));
-	strcpy(env[nr], "NAME=");
-	strcat(env[nr], st_strip_path(s->name));
-	nr++;
-
-	env[nr] = (char *) i_calloc(1, sizeof(char) * (7 + strlen(s->name)));
-	strcpy(env[nr], "CLASS=");
-	strcat(env[nr], s->name);
-	st_strip_end(&env[nr]);
-	nr++;
+	/* count ENVs in service ENV variable */
+	if (s)
+		allocate += count_type(&ENV, s);
 
-	if (g.dev_console)
-	{
-	    env[nr] = (char *) i_calloc(1,
-					sizeof(char) * (9 +
-							strlen(g.
-							       dev_console)));
-	    strcpy(env[nr], "CONSOLE=");
-	    strcat(env[nr], g.dev_console);
-	    nr++;
-	}
-	else
-	{
-	    env[nr] = (char *) i_calloc(1,
-					sizeof(char) * (9 +
-							strlen
-							(INITNG_CONSOLE)));
-	    strcpy(env[nr], "CONSOLE=");
-	    strcat(env[nr], INITNG_CONSOLE);
-	    nr++;
-	}
 
-	if (g.runlevel && (nr + 1) < allocate)
+	/* finally allocate */
+	env = (char **) i_calloc(allocate, sizeof(char *));
+
+	/* duplicate */
+#ifdef USE_OLD_ENV
+	for (nr = 0; environ[nr] && nr < allocate; nr++)
 	{
-	    env[nr] = (char *) i_calloc(1,
-					sizeof(char) * (10 +
-							strlen(g.runlevel)));
-	    strcpy(env[nr], "RUNLEVEL=");
-	    strcat(env[nr], g.runlevel);
-	    nr++;
+		env[nr] = i_strdup(environ[nr]);
 	}
+#endif
 
-	if (g.old_runlevel && (nr + 1) < allocate)
+	/* add all static defined above in initng_environ */
+	for (nr = 0; initng_environ[nr]; nr++)
 	{
-	    env[nr] = (char *) i_calloc(1,
-					sizeof(char) * (14 +
-							strlen(g.
-							       old_runlevel)));
-	    strcpy(env[nr], "PREVLEVEL=");
-	    strcat(env[nr], g.old_runlevel);
-	    nr++;
+		env[nr] = i_strdup(initng_environ[nr]);
 	}
 
-	env[nr] = NULL;
-	/* insert all env strings from config */
+
+	if (s && (nr + 4) < allocate)
 	{
-	    var = NULL;
-	    s_data *tmp = NULL;
+		env[nr] = (char *) i_calloc(1, sizeof(char) * (9 + strlen(s->name)));
+		strcpy(env[nr], "SERVICE=");
+		strcat(env[nr], s->name);
+		nr++;
+
+		env[nr] = (char *) i_calloc(1, sizeof(char) * (6 + strlen(s->name)));
+		strcpy(env[nr], "NAME=");
+		strcat(env[nr], st_strip_path(s->name));
+		nr++;
+
+		env[nr] = (char *) i_calloc(1, sizeof(char) * (7 + strlen(s->name)));
+		strcpy(env[nr], "CLASS=");
+		strcat(env[nr], s->name);
+		st_strip_end(&env[nr]);
+		nr++;
+
+		if (g.dev_console)
+		{
+			env[nr] = (char *) i_calloc(1,
+										sizeof(char) * (9 +
+														strlen(g.
+															   dev_console)));
+			strcpy(env[nr], "CONSOLE=");
+			strcat(env[nr], g.dev_console);
+			nr++;
+		}
+		else
+		{
+			env[nr] = (char *) i_calloc(1,
+										sizeof(char) * (9 +
+														strlen
+														(INITNG_CONSOLE)));
+			strcpy(env[nr], "CONSOLE=");
+			strcat(env[nr], INITNG_CONSOLE);
+			nr++;
+		}
 
-	    while ((nr + 1) < allocate)
-	    {
-		char *fixed = NULL;
-
-		if (!(tmp = get_next(&ENV, s, tmp)))
-		    break;
-
-		fixed = fix_variables(tmp->t.s, s);
-
-		/* then malloc */
-		var = i_calloc((strlen(tmp->vn) + strlen(fixed) + 3),
-			       sizeof(char));
-		if (!var)
-		    continue;
-
-		/* copy the data */
-		strcpy(var, tmp->vn);
-		strcat(var, "=");
-		strcat(var, fixed);
-
-		/* free the fixed ones */
-		free(fixed);
-
-		/* check for duplicates */
-		for (i = 0; i < nr; i++)
-		{
-		    if (is_same_env_var(env[i], var))
-		    {
-			/* we may want to override environemntal variables
-			   set above, particularly PATH and HOME */
-			free(env[i]);
-			env[i] = var;
-			break;
-		    }
-		}
-
-		if (i == nr)
-		    env[nr++] = var;
-	    }
+		if (g.runlevel && (nr + 1) < allocate)
+		{
+			env[nr] = (char *) i_calloc(1,
+										sizeof(char) * (10 +
+														strlen(g.runlevel)));
+			strcpy(env[nr], "RUNLEVEL=");
+			strcat(env[nr], g.runlevel);
+			nr++;
+		}
+
+		if (g.old_runlevel && (nr + 1) < allocate)
+		{
+			env[nr] = (char *) i_calloc(1,
+										sizeof(char) * (14 +
+														strlen(g.
+															   old_runlevel)));
+			strcpy(env[nr], "PREVLEVEL=");
+			strcat(env[nr], g.old_runlevel);
+			nr++;
+		}
+
+		env[nr] = NULL;
+		/* insert all env strings from config */
+		{
+			var = NULL;
+			s_data *tmp = NULL;
+
+			while ((nr + 1) < allocate)
+			{
+				char *fixed = NULL;
+
+				if (!(tmp = get_next(&ENV, s, tmp)))
+					break;
+
+				fixed = fix_variables(tmp->t.s, s);
+
+				/* then malloc */
+				var = i_calloc((strlen(tmp->vn) + strlen(fixed) + 3),
+							   sizeof(char));
+				if (!var)
+					continue;
+
+				/* copy the data */
+				strcpy(var, tmp->vn);
+				strcat(var, "=");
+				strcat(var, fixed);
+
+				/* free the fixed ones */
+				free(fixed);
+
+				/* check for duplicates */
+				for (i = 0; i < nr; i++)
+				{
+					if (is_same_env_var(env[i], var))
+					{
+						/* we may want to override environemntal variables
+						   set above, particularly PATH and HOME */
+						free(env[i]);
+						env[i] = var;
+						break;
+					}
+				}
+
+				if (i == nr)
+					env[nr++] = var;
+			}
+		}
 	}
-    }
 
-    /* null last */
-    if (env[nr] != NULL)
-	env[nr++] = NULL;
+	/* null last */
+	if (env[nr] != NULL)
+		env[nr++] = NULL;
 
 #ifdef DEBUG
-    for (nr = 0; env[nr]; nr++)
-    {
-	D_("environ[%i] = \"%s\"\n", nr, env[nr]);
-    }
+	for (nr = 0; env[nr]; nr++)
+	{
+		D_("environ[%i] = \"%s\"\n", nr, env[nr]);
+	}
 #endif
 
-    /* return new environ */
-    return (env);
+	/* return new environ */
+	return (env);
 }
 
 /* this frees an environment variable - not to be used on the output of
@@ -243,124 +243,124 @@
  */
 void free_environ(char **tf)
 {
-    int i = 0;
+	int i = 0;
 
-    D_("free_environ();\n");
-    assert(tf);
-    for (i = 0; tf[i]; tf++)
-    {
-	free(tf[i]);
-    }
-    free(tf);
+	D_("free_environ();\n");
+	assert(tf);
+	for (i = 0; tf[i]; tf++)
+	{
+		free(tf[i]);
+	}
+	free(tf);
 }
 
 int is_same_env_var(char *var1, char *var2)
 {
-    int i = 0;
+	int i = 0;
 
-    if (!var1 || !var2)
-	return 0;			    /* bad error checking in caller! */
+	if (!var1 || !var2)
+		return 0;							/* bad error checking in caller! */
 
-    for (i = 0; var1[i] && var2[i] && var1[i] != '=' && var1[i] == var2[i];
-	 i++)
-	;
+	for (i = 0; var1[i] && var2[i] && var1[i] != '=' && var1[i] == var2[i];
+		 i++)
+		;
 
-    return var1[i] == var2[i];
+	return var1[i] == var2[i];
 }
 
 /* Handles redefinitions like "env FOO = $FOO bar" */
 char *fix_redefined_variable(const char *name, const char *oldval,
-			     const char *newdef)
+							 const char *newdef)
 {
-    char *to;			/* this is the pointer we are going to return */
-    char *set;			/* pointer to step */
+	char *to;					/* this is the pointer we are going to return */
+	char *set;					/* pointer to step */
 
-    assert(name);
-    assert(oldval);
-    assert(newdef);
-
-    /* make sure we got any data */
-    if (!newdef)
-	return (NULL);
-
-    /* allocate that much memory that we think we need */
-    /* TODO, add checks that this value is never overridden */
-    to = (char *) i_calloc((strlen(newdef) + 150), sizeof(char));
-    if (!to)
-	return (NULL);
-
-    set = to;
-    /* while there is data to parse */
-    while (newdef[0])
-    {
-	int len = 0;
-
-	/*
-	 * if its not containing the magical char loop, just copy the
-	 * char and continue the main loop.
-	 */
-	if (newdef[0] != '$')
-	{
-	    set[0] = newdef[0];
-	    newdef++;
-	    set++;
-	    set[0] = '\0';
-	    continue;
-	}
+	assert(name);
+	assert(oldval);
+	assert(newdef);
+
+	/* make sure we got any data */
+	if (!newdef)
+		return (NULL);
+
+	/* allocate that much memory that we think we need */
+	/* TODO, add checks that this value is never overridden */
+	to = (char *) i_calloc((strlen(newdef) + 150), sizeof(char));
+	if (!to)
+		return (NULL);
+
+	set = to;
+	/* while there is data to parse */
+	while (newdef[0])
+	{
+		int len = 0;
+
+		/*
+		 * if its not containing the magical char loop, just copy the
+		 * char and continue the main loop.
+		 */
+		if (newdef[0] != '$')
+		{
+			set[0] = newdef[0];
+			newdef++;
+			set++;
+			set[0] = '\0';
+			continue;
+		}
 
 
-	/* jump the '$' char */
-	newdef++;
-	if (!newdef[0])
-	    continue;
+		/* jump the '$' char */
+		newdef++;
+		if (!newdef[0])
+			continue;
 
-	/*
-	 * Calculate length of variable ${VARIABLE}.
-	 */
-	if (newdef[0] == '{')		    /* if this is a ${VARIABLE} */
-	{
-	    newdef++;
-	    for (; newdef[len] && newdef[len] != '}'; len++) ;
-	}
-	else				    /* else a $VARIABLE */
-	{
-	    for (; isgraph(newdef[len]); len++) ;
-	}
+		/*
+		 * Calculate length of variable ${VARIABLE}.
+		 */
+		if (newdef[0] == '{')				/* if this is a ${VARIABLE} */
+		{
+			newdef++;
+			for (; newdef[len] && newdef[len] != '}'; len++) ;
+		}
+		else								/* else a $VARIABLE */
+		{
+			for (; isgraph(newdef[len]); len++) ;
+		}
 
-	if (strncasecmp(newdef, name, len) == 0 && (int) strlen(name) == len)
-	{
-	    strcpy(set, oldval);
-	    /* go forward */
-	    newdef += len;
-	    if (newdef[0] == '}')
-		newdef++;
-	    while (set[0])
-		set++;
-	}
-	else
-	{
-	    if (newdef[-1] == '{')
-	    {
-		strncpy(set, newdef - 2, len + 2);
-		newdef += len;
-		set += len + 2;
-		set[0] = '\0';
-	    }
-	    else
-	    {
-		strncpy(set, newdef - 1, len + 1);
-		newdef += len;
-		set += len + 1;
-		set[0] = '\0';
-	    }
+		if (strncasecmp(newdef, name, len) == 0 && (int) strlen(name) == len)
+		{
+			strcpy(set, oldval);
+			/* go forward */
+			newdef += len;
+			if (newdef[0] == '}')
+				newdef++;
+			while (set[0])
+				set++;
+		}
+		else
+		{
+			if (newdef[-1] == '{')
+			{
+				strncpy(set, newdef - 2, len + 2);
+				newdef += len;
+				set += len + 2;
+				set[0] = '\0';
+			}
+			else
+			{
+				strncpy(set, newdef - 1, len + 1);
+				newdef += len;
+				set += len + 1;
+				set[0] = '\0';
+			}
+		}
 	}
-    }
 
-    /* make sure end is terminated */
-    set[0] = '\0';
+	/* make sure end is terminated */
+	set[0] = '\0';
 
-    /* return the string we now fixed */
-    return (to);
+	/* return the string we now fixed */
+	return (to);
 
 }
 
@@ -369,222 +369,222 @@
  */
 char *fix_variables(const char *from, active_db_h * s)
 {
-    char *to;			/* this is the pointer we are going to return */
-    char *set;			/* pointer to step */
-    int i;			/* temporary counter */
-
-    assert(s);
-    assert(s->name);
-
-    /* make sure we got any data */
-    if (!from)
-	return (NULL);
-
-    /* allocate that much memory that we think we need */
-    /* TODO, add checks that this value is never overridden */
-    to = (char *) i_calloc((strlen(from) + 150), sizeof(char));
-    if (!to)
-	return (NULL);
-
-    set = to;
-    /* while there is data to parse */
-    while (from[0])
-    {
-	int len = 0;
-
-	/*
-	 * if its not containing the magical char loop, just copy the
-	 * char and continue the main loop.
-	 */
-	if (from[0] != '$')
-	{
-	    set[0] = from[0];
-	    from++;
-	    set++;
-	    set[0] = '\0';
-	    continue;
-	}
-
-
-	/* jump the '$' char */
-	from++;
-	if (!from[0])
-	    continue;
-
-	/*
-	 * Calculate length of variable ${VARIABLE}.
-	 */
-	if (from[0] == '{')		    /* if this is a ${VARIABLE} */
-	{
-	    from++;
-	    for (; from[len] && from[len] != '}'; len++) ;
-	}
-	else				    /* else a $VARIABLE */
-	{
-	    for (; isgraph(from[len]); len++) ;
-	}
+	char *to;					/* this is the pointer we are going to return */
+	char *set;					/* pointer to step */
+	int i;						/* temporary counter */
+
+	assert(s);
+	assert(s->name);
+
+	/* make sure we got any data */
+	if (!from)
+		return (NULL);
+
+	/* allocate that much memory that we think we need */
+	/* TODO, add checks that this value is never overridden */
+	to = (char *) i_calloc((strlen(from) + 150), sizeof(char));
+	if (!to)
+		return (NULL);
+
+	set = to;
+	/* while there is data to parse */
+	while (from[0])
+	{
+		int len = 0;
+
+		/*
+		 * if its not containing the magical char loop, just copy the
+		 * char and continue the main loop.
+		 */
+		if (from[0] != '$')
+		{
+			set[0] = from[0];
+			from++;
+			set++;
+			set[0] = '\0';
+			continue;
+		}
 
-	/*
-	 * Start comparing keywords.
-	 */
 
-	if (strncasecmp(from, "NAME", len) == 0)
-	{
-	    const char *tmp = NULL;
+		/* jump the '$' char */
+		from++;
+		if (!from[0])
+			continue;
+
+		/*
+		 * Calculate length of variable ${VARIABLE}.
+		 */
+		if (from[0] == '{')					/* if this is a ${VARIABLE} */
+		{
+			from++;
+			for (; from[len] && from[len] != '}'; len++) ;
+		}
+		else								/* else a $VARIABLE */
+		{
+			for (; isgraph(from[len]); len++) ;
+		}
 
-	    if ((tmp = st_strip_path(s->name)))
-	    {
-		strcpy(set, tmp);
-		goto go_forward;
-	    }
-	}
+		/*
+		 * Start comparing keywords.
+		 */
 
-	if (strncasecmp(from, "SERVICE", len) == 0)
-	{
-	    strcpy(set, s->name);
-	    goto go_forward;
-	}
+		if (strncasecmp(from, "NAME", len) == 0)
+		{
+			const char *tmp = NULL;
 
-	if (strncasecmp(from, "CLASS", len) == 0)
-	{
-	    char *tmp = NULL;
+			if ((tmp = st_strip_path(s->name)))
+			{
+				strcpy(set, tmp);
+				goto go_forward;
+			}
+		}
 
-	    if ((tmp = st_get_path(s->name)))
-	    {
-		strcpy(set, tmp);
-		free(tmp);
-	    }
-	    goto go_forward;
-	}
+		if (strncasecmp(from, "SERVICE", len) == 0)
+		{
+			strcpy(set, s->name);
+			goto go_forward;
+		}
 
-	if (g.runlevel && strncasecmp(from, "CONSOLE", len) == 0)
-	{
-	    if (g.dev_console)
-		strcpy(set, g.dev_console);
-	    else
-		strcpy(set, INITNG_CONSOLE);
+		if (strncasecmp(from, "CLASS", len) == 0)
+		{
+			char *tmp = NULL;
 
-	    goto go_forward;
-	}
+			if ((tmp = st_get_path(s->name)))
+			{
+				strcpy(set, tmp);
+				free(tmp);
+			}
+			goto go_forward;
+		}
 
-	if (g.runlevel && strncasecmp(from, "RUNLEVEL", len) == 0)
-	{
-	    strcpy(set, g.runlevel);
-	    goto go_forward;
-	}
+		if (g.runlevel && strncasecmp(from, "CONSOLE", len) == 0)
+		{
+			if (g.dev_console)
+				strcpy(set, g.dev_console);
+			else
+				strcpy(set, INITNG_CONSOLE);
 
-	if (g.runlevel && strncasecmp(from, "PREVLEVEL", len) == 0)
-	{
-	    strcpy(set, g.old_runlevel);
-	    goto go_forward;
-	}
+			goto go_forward;
+		}
 
-	/* Fetch variable from initng_environ */
-	for (i = 0; initng_environ[i]; i++)
-	{
-	    if (strncasecmp(from, initng_environ[i], len) == 0
-		&& initng_environ[i][len] == '=')
-	    {
-		strcpy(set, &initng_environ[i][len + 1]);
-		goto go_forward;
-	    }
-	}
+		if (g.runlevel && strncasecmp(from, "RUNLEVEL", len) == 0)
+		{
+			strcpy(set, g.runlevel);
+			goto go_forward;
+		}
 
-	{
-	    s_data *tmp = NULL;
+		if (g.runlevel && strncasecmp(from, "PREVLEVEL", len) == 0)
+		{
+			strcpy(set, g.old_runlevel);
+			goto go_forward;
+		}
 
-	    while ((tmp = get_next(&ENV, s, tmp)))
-	    {
-		if (strncasecmp(from, tmp->vn, len) == 0 && tmp->vn[len] == 0)
+		/* Fetch variable from initng_environ */
+		for (i = 0; initng_environ[i]; i++)
 		{
-		    strcpy(set, tmp->t.s);
-		    goto go_forward;
+			if (strncasecmp(from, initng_environ[i], len) == 0
+				&& initng_environ[i][len] == '=')
+			{
+				strcpy(set, &initng_environ[i][len + 1]);
+				goto go_forward;
+			}
 		}
-	    }
-	}
 
-	/* Get the variable from the data set on an initng_variable */
-	{
-	    s_entry *entry = NULL;
+		{
+			s_data *tmp = NULL;
+
+			while ((tmp = get_next(&ENV, s, tmp)))
+			{
+				if (strncasecmp(from, tmp->vn, len) == 0 && tmp->vn[len] == 0)
+				{
+					strcpy(set, tmp->t.s);
+					goto go_forward;
+				}
+			}
+		}
 
-	    /* Copy the string, so that we can put an '\0' on the end */
-	    char *tmp = i_strndup(from, len);
+		/* Get the variable from the data set on an initng_variable */
+		{
+			s_entry *entry = NULL;
 
-	    if (!tmp)
-		goto print_error;
+			/* Copy the string, so that we can put an '\0' on the end */
+			char *tmp = i_strndup(from, len);
 
-	    /* search if a initng variable exits with that name */
-	    entry = initng_service_data_types_find(tmp);
+			if (!tmp)
+				goto print_error;
 
-	    /* free the duped one */
-	    free(tmp);
+			/* search if a initng variable exits with that name */
+			entry = initng_service_data_types_find(tmp);
 
-	    /* if we got an entry, and if the entry exits in this service */
-	    if (entry && is(entry, s))
-	    {
-		/* Handle differently with different types */
-		switch (entry->opt_type)
-		{
-			/* if it is a string, just strcpy in it */
-		    case STRING:
-			{
-			    strcpy(set, get_string(entry, s));
-			    goto go_forward;
-			}
-		    case STRINGS:
-			{
-			    const char *tmp2 = NULL;
-			    s_data *itterator = NULL;
+			/* free the duped one */
+			free(tmp);
 
-			    while ((tmp2 =
-				    get_next_string(entry, s, &itterator)))
-			    {
-				strcat(set, tmp2);
-				strcat(set, " ");
-			    }
-			    if (tmp2)
-				goto go_forward;
-			}
-			/* if it is an integer, sprintf in it */
-		    case INT:
-			{
-			    sprintf(set, "%i", get_int(entry, s));
-			    goto go_forward;
-			}
-		    default:
+			/* if we got an entry, and if the entry exits in this service */
+			if (entry && is(entry, s))
 			{
-			    D_("Don't know how to set a variable with %s:%i\n", entry->opt_name, entry->opt_type);
-			    break;
+				/* Handle differently with different types */
+				switch (entry->opt_type)
+				{
+						/* if it is a string, just strcpy in it */
+					case STRING:
+						{
+							strcpy(set, get_string(entry, s));
+							goto go_forward;
+						}
+					case STRINGS:
+						{
+							const char *tmp2 = NULL;
+							s_data *itterator = NULL;
+
+							while ((tmp2 =
+									get_next_string(entry, s, &itterator)))
+							{
+								strcat(set, tmp2);
+								strcat(set, " ");
+							}
+							if (tmp2)
+								goto go_forward;
+						}
+						/* if it is an integer, sprintf in it */
+					case INT:
+						{
+							sprintf(set, "%i", get_int(entry, s));
+							goto go_forward;
+						}
+					default:
+						{
+							D_("Don't know how to set a variable with %s:%i\n", entry->opt_name, entry->opt_type);
+							break;
+						}
+				}
 			}
 		}
-	    }
-	}
 
 
-      print_error:
-	/* Print a fancy error message */
-	{
-	    char *tmp = strndup(from, len);
+	  print_error:
+		/* Print a fancy error message */
+		{
+			char *tmp = strndup(from, len);
 
-	    W_("Service %s Unset variable ${%s}!\n", s->name, tmp);
-	    free(tmp);
-	}
-	/* this will set the value to nothing */
-	set[0] = '\0';
+			W_("Service %s Unset variable ${%s}!\n", s->name, tmp);
+			free(tmp);
+		}
+		/* this will set the value to nothing */
+		set[0] = '\0';
 
-      go_forward:
-	/* go forward */
-	from += len;
-	if (from[0] == '}')
-	    from++;
-	while (set[0])
-	    set++;
+	  go_forward:
+		/* go forward */
+		from += len;
+		if (from[0] == '}')
+			from++;
+		while (set[0])
+			set++;
 
-    }
+	}
 
-    /* make sure end is terminated */
-    set[0] = '\0';
+	/* make sure end is terminated */
+	set[0] = '\0';
 
-    /* return the string we now fixed */
-    return (to);
+	/* return the string we now fixed */
+	return (to);
 }

Modified: initng/trunk/src/initng_env_variable.h
==============================================================================
--- initng/trunk/src/initng_env_variable.h	(original)
+++ initng/trunk/src/initng_env_variable.h	Wed Apr  5 23:11:19 2006
@@ -25,7 +25,7 @@
 #include "initng_active_db.h"
 
 char *fix_redefined_variable(const char *name, const char *oldval,
-			     const char *newdef);
+							 const char *newdef);
 char *fix_variables(const char *from, active_db_h * s);
 char **new_environ(active_db_h * s);
 void free_environ(char **tf);

Modified: initng/trunk/src/initng_error.c
==============================================================================
--- initng/trunk/src/initng_error.c	(original)
+++ initng/trunk/src/initng_error.c	Wed Apr  5 23:11:19 2006
@@ -21,7 +21,7 @@
 #include "initng.h"
 
 #define _GNU_SOURCE
-#include <stdlib.h>			    /* free() exit() */
+#include <stdlib.h>							/* free() exit() */
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
@@ -37,92 +37,92 @@
 int lock_error_printing = 0;
 
 static void initng_failsafe_print_error(e_mt mt, const char *file,
-					const char *func, int line,
-					const char *format, va_list arg)
+										const char *func, int line,
+										const char *format, va_list arg)
 {
-    struct tm *ts;
-    time_t t;
+	struct tm *ts;
+	time_t t;
 
-    t = time(0);
-    ts = localtime(&t);
+	t = time(0);
+	ts = localtime(&t);
 
 
-    switch (mt)
-    {
-	case MSG_FAIL:
-	    if (file && func)
-		fprintf(stderr,
-			"\n\n FAILSAFE ERROR ** \"%s\", %s() line %i:\n",
-			file, func, line);
-	    fprintf(stderr, " %.2i:%.2i:%.2i -- FAIL:\t", ts->tm_hour,
-		    ts->tm_min, ts->tm_sec);
-	    break;
-	case MSG_WARN:
-	    if (file && func)
-		fprintf(stderr,
-			"\n\n FAILSAFE ERROR ** \"%s\", %s() line %i:\n",
-			file, func, line);
-	    fprintf(stderr, " %.2i:%.2i:%.2i -- WARN:\t", ts->tm_hour,
-		    ts->tm_min, ts->tm_sec);
-	    break;
-	default:
-	    break;
-    }
+	switch (mt)
+	{
+		case MSG_FAIL:
+			if (file && func)
+				fprintf(stderr,
+						"\n\n FAILSAFE ERROR ** \"%s\", %s() line %i:\n",
+						file, func, line);
+			fprintf(stderr, " %.2i:%.2i:%.2i -- FAIL:\t", ts->tm_hour,
+					ts->tm_min, ts->tm_sec);
+			break;
+		case MSG_WARN:
+			if (file && func)
+				fprintf(stderr,
+						"\n\n FAILSAFE ERROR ** \"%s\", %s() line %i:\n",
+						file, func, line);
+			fprintf(stderr, " %.2i:%.2i:%.2i -- WARN:\t", ts->tm_hour,
+					ts->tm_min, ts->tm_sec);
+			break;
+		default:
+			break;
+	}
 
-    vfprintf(stderr, format, arg);
+	vfprintf(stderr, format, arg);
 
 }
 
 int initng_error_print(e_mt mt, const char *file, const char *func, int line,
-		       const char *format, ...)
+					   const char *format, ...)
 {
-    assert(file);
-    assert(func);
-    assert(format);
-
-    int delivered = FALSE;
-    s_call *current = NULL;
-    va_list arg;
-
-    /* This lock is to make sure we don't get into an endless print loop */
-    if (lock_error_printing == 1)
-	return (0);
+	assert(file);
+	assert(func);
+	assert(format);
+
+	int delivered = FALSE;
+	s_call *current = NULL;
+	va_list arg;
+
+	/* This lock is to make sure we don't get into an endless print loop */
+	if (lock_error_printing == 1)
+		return (0);
 
-    /* put the lock, to avoid a circular bug */
-    lock_error_printing = 1;
+	/* put the lock, to avoid a circular bug */
+	lock_error_printing = 1;
 
-    /* start the variable list */
-    va_start(arg, format);
+	/* start the variable list */
+	va_start(arg, format);
 
-    /* check for hooks */
-    while_list(current, &g.ERR_MSG)
-    {
-	va_list pass;
+	/* check for hooks */
+	while_list(current, &g.ERR_MSG)
+	{
+		va_list pass;
 
-	va_copy(pass, arg);
+		va_copy(pass, arg);
 
-	if ((*current->c.err) (mt, file, func, line, format, pass) == TRUE)
-	    delivered = TRUE;
+		if ((*current->c.err) (mt, file, func, line, format, pass) == TRUE)
+			delivered = TRUE;
 
-	va_end(pass);
-    }
+		va_end(pass);
+	}
 
-    /* Print on failsafe if no hook is to listen. */
-    if (delivered != TRUE)
-    {
-	va_list pass;
+	/* Print on failsafe if no hook is to listen. */
+	if (delivered != TRUE)
+	{
+		va_list pass;
 
-	va_copy(pass, arg);
+		va_copy(pass, arg);
 
-	initng_failsafe_print_error(mt, file, func, line, format, pass);
+		initng_failsafe_print_error(mt, file, func, line, format, pass);
 
-	va_end(pass);
-    }
+		va_end(pass);
+	}
 
-    va_end(arg);
+	va_end(arg);
 
-    lock_error_printing = 0;
-    return (TRUE);
+	lock_error_printing = 0;
+	return (TRUE);
 }
 
 
@@ -138,109 +138,109 @@
 
 static void initng_verbose_print(void)
 {
-    int i;
+	int i;
 
-    if (lock_error_printing == 1)
-	return;
+	if (lock_error_printing == 1)
+		return;
 
-    W_("This words will i look for in debug: \n");
-    for (i = 0; i < MAX_VERBOSES; i++)
-	if (g.verbose_this[i])
-	    W_("  * \"%s\"\n", g.verbose_this[i]);
+	W_("This words will i look for in debug: \n");
+	for (i = 0; i < MAX_VERBOSES; i++)
+		if (g.verbose_this[i])
+			W_("  * \"%s\"\n", g.verbose_this[i]);
 }
 
 int initng_error_verbose_add(const char *string)
 {
-    int i = 0;
+	int i = 0;
 
-    if (g.verbose == 1)
-	g.verbose = 3;
-    else
-	g.verbose = 2;
+	if (g.verbose == 1)
+		g.verbose = 3;
+	else
+		g.verbose = 2;
 
 
-    while (g.verbose_this[i] && i < MAX_VERBOSES)
-	i++;
+	while (g.verbose_this[i] && i < MAX_VERBOSES)
+		i++;
 
-    if (i >= MAX_VERBOSES - 1)
-    {
-	F_("Can't add another \"%s\" debug trace\n", string);
-	return (FALSE);
-    }
+	if (i >= MAX_VERBOSES - 1)
+	{
+		F_("Can't add another \"%s\" debug trace\n", string);
+		return (FALSE);
+	}
 
-    g.verbose_this[i] = i_strdup(string);
+	g.verbose_this[i] = i_strdup(string);
 
-    initng_verbose_print();
+	initng_verbose_print();
 
-    if (g.verbose_this[i])
-	return (TRUE);
-    return (FALSE);
+	if (g.verbose_this[i])
+		return (TRUE);
+	return (FALSE);
 }
 
 int initng_error_verbose_del(const char *string)
 {
-    int i;
-    int t = FALSE;
+	int i;
+	int t = FALSE;
 
-    for (i = 0; i < MAX_VERBOSES; i++)
-	if (g.verbose_this[i] && strcasecmp(g.verbose_this[i], string) == 0)
-	{
-	    free(g.verbose_this[i]);
-	    g.verbose_this[i] = NULL;
-	    t = TRUE;
-	}
-    initng_verbose_print();
-    return (t);
+	for (i = 0; i < MAX_VERBOSES; i++)
+		if (g.verbose_this[i] && strcasecmp(g.verbose_this[i], string) == 0)
+		{
+			free(g.verbose_this[i]);
+			g.verbose_this[i] = NULL;
+			t = TRUE;
+		}
+	initng_verbose_print();
+	return (t);
 }
 
 void initng_error_print_func(const char *file, const char *func)
 {
-    int i = 0;
+	int i = 0;
 
-    if (lock_error_printing == 1)
-	return;
-    lock_error_printing = 1;
+	if (lock_error_printing == 1)
+		return;
+	lock_error_printing = 1;
 
-    if (g.verbose == 2 || g.verbose == 3)
-    {
-	for (i = 0; i < MAX_VERBOSES; i++)
+	if (g.verbose == 2 || g.verbose == 3)
 	{
-	    if (g.verbose_this[i])
-	    {
-		if (g.verbose_this[i][0] == '%' && (g.verbose_this[i] + 1))
-		{
-		    if (strcasestr(file, (g.verbose_this[i]) + 1) ||
-			strcasestr(func, (g.verbose_this[i]) + 1))
-		    {
-			lock_error_printing = 0;
-			return;
-		    }
-		}
-		else
+		for (i = 0; i < MAX_VERBOSES; i++)
 		{
-		    if (strcasestr(file, g.verbose_this[i]) ||
-			strcasestr(func, g.verbose_this[i]))
-		    {
-			i = 1;
-			break;
-		    }
+			if (g.verbose_this[i])
+			{
+				if (g.verbose_this[i][0] == '%' && (g.verbose_this[i] + 1))
+				{
+					if (strcasestr(file, (g.verbose_this[i]) + 1) ||
+						strcasestr(func, (g.verbose_this[i]) + 1))
+					{
+						lock_error_printing = 0;
+						return;
+					}
+				}
+				else
+				{
+					if (strcasestr(file, g.verbose_this[i]) ||
+						strcasestr(func, g.verbose_this[i]))
+					{
+						i = 1;
+						break;
+					}
+				}
+			}
 		}
-	    }
 	}
-    }
 
-    if (g.verbose == 1 || i == 1)
-    {
-	if (last_file != file || last_func != func)
+	if (g.verbose == 1 || i == 1)
 	{
-	    fprintf(stderr, "\n\n ** \"%s\", %s():\n", file, func);
-	}
+		if (last_file != file || last_func != func)
+		{
+			fprintf(stderr, "\n\n ** \"%s\", %s():\n", file, func);
+		}
 
-	last_file = file;
-	last_func = func;
-    }
+		last_file = file;
+		last_func = func;
+	}
 
-    lock_error_printing = 0;
+	lock_error_printing = 0;
 }
 
 
@@ -249,97 +249,97 @@
 
 
 int initng_error_print_debug(const char *file, const char *func, int line,
-			     const char *format, ...)
+							 const char *format, ...)
 {
-    int done;
-    struct tm *ts;
-    int i;
-    time_t t;
-
-
-    assert(file);
-    assert(func);
-
-    if (lock_error_printing == 1)
-	return (0);
-    lock_error_printing = 1;
+	int done;
+	struct tm *ts;
+	int i;
+	time_t t;
+
+
+	assert(file);
+	assert(func);
+
+	if (lock_error_printing == 1)
+		return (0);
+	lock_error_printing = 1;
 
 
 
-    if (g.verbose == 1)
-	goto yes;
-
-    if (g.verbose == 2 || g.verbose == 3)
-	for (i = 0; i < MAX_VERBOSES; i++)
-	    if (g.verbose_this[i])
-	    {
-		if (g.verbose_this[i][0] == '%' && (g.verbose_this[i] + 1))
-		{
-		    if (strcasestr(file, (g.verbose_this[i]) + 1) ||
-			strcasestr(func, (g.verbose_this[i]) + 1))
-		    {
-			lock_error_printing = 0;
-			return (TRUE);
-		    }
-		}
-		else
-		{
-		    if (strcasestr(file, g.verbose_this[i]) ||
-			strcasestr(func, g.verbose_this[i]))
-		    {
-			goto yes;
-		    }
-		}
-	    }
-
-    if (g.verbose == 3)
-	goto yes;
-    /* else */
+	if (g.verbose == 1)
+		goto yes;
+
+	if (g.verbose == 2 || g.verbose == 3)
+		for (i = 0; i < MAX_VERBOSES; i++)
+			if (g.verbose_this[i])
+			{
+				if (g.verbose_this[i][0] == '%' && (g.verbose_this[i] + 1))
+				{
+					if (strcasestr(file, (g.verbose_this[i]) + 1) ||
+						strcasestr(func, (g.verbose_this[i]) + 1))
+					{
+						lock_error_printing = 0;
+						return (TRUE);
+					}
+				}
+				else
+				{
+					if (strcasestr(file, g.verbose_this[i]) ||
+						strcasestr(func, g.verbose_this[i]))
+					{
+						goto yes;
+					}
+				}
+			}
+
+	if (g.verbose == 3)
+		goto yes;
+	/* else */
 
-    lock_error_printing = 0;
-    return (TRUE);
+	lock_error_printing = 0;
+	return (TRUE);
 
   yes:
 
-    /* print the function name, if not set */
-    if (last_file != file || last_func != func)
-    {
-	fprintf(stderr, "\n\n ** \"%s\", %s():\n", file, func);
-    }
+	/* print the function name, if not set */
+	if (last_file != file || last_func != func)
+	{
+		fprintf(stderr, "\n\n ** \"%s\", %s():\n", file, func);
+	}
 
-    last_file = file;
-    last_func = func;
+	last_file = file;
+	last_func = func;
 
-    if (g.i_am_init && getpid() != 1)
-    {
-	fprintf(stderr, " NON_INIT: ");
-    }
+	if (g.i_am_init && getpid() != 1)
+	{
+		fprintf(stderr, " NON_INIT: ");
+	}
 
-    /* Don't fetch time, until we know we wanna print on screen */
-    t = time(0);
-    ts = localtime(&t);
+	/* Don't fetch time, until we know we wanna print on screen */
+	t = time(0);
+	ts = localtime(&t);
 
 
-    fprintf(stderr, " %.2i:%.2i:%.2i -- line:%i\t", ts->tm_hour,
-	    ts->tm_min, ts->tm_sec, line);
+	fprintf(stderr, " %.2i:%.2i:%.2i -- line:%i\t", ts->tm_hour,
+			ts->tm_min, ts->tm_sec, line);
 
-    msgs++;
-    if (msgs > 20)
-    {
-	sleep(0.5);
-	msgs = 0;
-    }
+	msgs++;
+	if (msgs > 20)
+	{
+		sleep(0.5);
+		msgs = 0;
+	}
 
-    va_list arg;
+	va_list arg;
 
-    va_start(arg, format);
+	va_start(arg, format);
 
-    done = vfprintf(stderr, format, arg);
+	done = vfprintf(stderr, format, arg);
 
-    va_end(arg);
+	va_end(arg);
 
-    lock_error_printing = 0;
-    return (done);
+	lock_error_printing = 0;
+	return (done);
 }
 
 #endif

Modified: initng/trunk/src/initng_error.h
==============================================================================
--- initng/trunk/src/initng_error.h	(original)
+++ initng/trunk/src/initng_error.h	Wed Apr  5 23:11:19 2006
@@ -27,12 +27,12 @@
 int initng_error_verbose_add(const char *string);
 int initng_error_verbose_del(const char *string);
 int initng_error_print_debug(const char *file, const char *func, int line,
-			     const char *format, ...);
+							 const char *format, ...);
 
 #endif
 
 int initng_error_print(e_mt mt, const char *file, const char *func, int line,
-		       const char *format, ...);
+					   const char *format, ...);
 
 void initng_error_print_func(const char *file, const char *func);
 #endif

Modified: initng/trunk/src/initng_execute.c
==============================================================================
--- initng/trunk/src/initng_execute.c	(original)
+++ initng/trunk/src/initng_execute.c	Wed Apr  5 23:11:19 2006
@@ -20,12 +20,12 @@
 
 #include "initng.h"
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <unistd.h>			    /* execv() pipe() usleep() pause() chown() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdlib.h>			    /* free() exit() */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <unistd.h>							/* execv() pipe() usleep() pause() chown() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdlib.h>							/* free() exit() */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
@@ -35,7 +35,7 @@
 #include "initng_global.h"
 #include "initng_process_db.h"
 #include "main.h"
-#include "initng_string_tools.h"	    /* split() */
+#include "initng_string_tools.h"			/* split() */
 #include "initng_execute.h"
 #include "initng_active_db.h"
 #include "initng_plugin_callers.h"
@@ -46,63 +46,63 @@
 
 int initng_execute_launch(active_db_h * service, ptype_h * type)
 {
-    s_call *current, *q = NULL;
-    process_h *process = NULL;
-    int ret = 0;
-
-    assert(service);
-    assert(type);
-
-    D_("start_launch(%s, %s);\n", service->name, type->name);
-
-    /* Try to get the current one */
-    process = initng_process_db_get(type, service);
-    if (process != NULL)
-    {
-	F_("There exists an \"%s\" process in \"%s\" already.\n",
-	   process->pt->name, service->name);
-	/*assert(NULL); */
-	return (FALSE);
-    }
-
-    /* Try to create a new one */
-    process = initng_process_db_new(type);
-    if (!process)
-    {
-	F_("(%s): unable to allocate start_process!\n", service->name);
-	return (FALSE);
-    }
-
-    /* add the process to our service */
-    list_add(&process->list, &service->processes.list);
-
-    /* walk the db with hooks */
-    while_list_safe(current, &g.LAUNCH, q)
-    {
-	/* call the start */
-	ret = (*current->c.launch) (service, process);
-
-	/* if launch succeeded */
-	if (ret >= TRUE)
-	    return (TRUE);
-
-	/* if that launcher did not get any to launch, take next launcher */
-	if (ret == FALSE)
-	    continue;
-	if (ret < FALSE)
-	    break;
-    }
-
-    if (ret < FALSE)			    /* ret == FAIL */
-	F_("initng_execute(%s): FAILED LAUNCHING, returned FAIL\n",
-	   service->name);
-    else
-	D_("initng_execute(%s): FAILED LAUNCHING, noting font to launch.\n",
-	   service->name);
-
-    /* on failure remove the process from list, and free it */
-    list_del(&process->list);
-    initng_process_db_free(process);
+	s_call *current, *q = NULL;
+	process_h *process = NULL;
+	int ret = 0;
+
+	assert(service);
+	assert(type);
+
+	D_("start_launch(%s, %s);\n", service->name, type->name);
+
+	/* Try to get the current one */
+	process = initng_process_db_get(type, service);
+	if (process != NULL)
+	{
+		F_("There exists an \"%s\" process in \"%s\" already.\n",
+		   process->pt->name, service->name);
+		/*assert(NULL); */
+		return (FALSE);
+	}
+
+	/* Try to create a new one */
+	process = initng_process_db_new(type);
+	if (!process)
+	{
+		F_("(%s): unable to allocate start_process!\n", service->name);
+		return (FALSE);
+	}
+
+	/* add the process to our service */
+	list_add(&process->list, &service->processes.list);
+
+	/* walk the db with hooks */
+	while_list_safe(current, &g.LAUNCH, q)
+	{
+		/* call the start */
+		ret = (*current->c.launch) (service, process);
+
+		/* if launch succeeded */
+		if (ret >= TRUE)
+			return (TRUE);
+
+		/* if that launcher did not get any to launch, take next launcher */
+		if (ret == FALSE)
+			continue;
+		if (ret < FALSE)
+			break;
+	}
+
+	if (ret < FALSE)						/* ret == FAIL */
+		F_("initng_execute(%s): FAILED LAUNCHING, returned FAIL\n",
+		   service->name);
+	else
+		D_("initng_execute(%s): FAILED LAUNCHING, noting font to launch.\n",
+		   service->name);
+
+	/* on failure remove the process from list, and free it */
+	list_del(&process->list);
+	initng_process_db_free(process);
 
-    return (ret);
+	return (ret);
 }

Modified: initng/trunk/src/initng_fd.c
==============================================================================
--- initng/trunk/src/initng_fd.c	(original)
+++ initng/trunk/src/initng_fd.c	Wed Apr  5 23:11:19 2006
@@ -24,7 +24,7 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <fcntl.h>			    /* fcntl() */
+#include <fcntl.h>							/* fcntl() */
 #include "initng.h"
 #include "initng_global.h"
 #include "initng_service_cache.h"
@@ -39,19 +39,19 @@
 
 void initng_fd_close_all(void)
 {
-    s_call *current, *safe = NULL;
+	s_call *current, *safe = NULL;
 
-    S_;
+	S_;
 
-    while_list_safe(current, &g.FDWATCHERS, safe)
-    {
-	close(current->c.fdh->fds);
-	list_del(&current->list);
-
-	if (current->from_file)
-	    free(current->from_file);
-	free(current);
-    }
+	while_list_safe(current, &g.FDWATCHERS, safe)
+	{
+		close(current->c.fdh->fds);
+		list_del(&current->list);
+
+		if (current->from_file)
+			free(current->from_file);
+		free(current);
+	}
 }
 
 /*
@@ -61,30 +61,30 @@
  * be printed to screen anyway.
  */
 static void initng_fd_plugin_readpipe(active_db_h * service,
-				      process_h * process, char *buffer_pos)
+									  process_h * process, char *buffer_pos)
 {
-    s_call *current = NULL;
-    int delivered = FALSE;
+	s_call *current = NULL;
+	int delivered = FALSE;
 
-    S_;
+	S_;
 
 
-    while_list(current, &g.PIPEWATCHERS)
-    {
-	D_("Calling pipewatcher plugin.\n");
-	if ((*current->c.pipewatcher) (service, process, buffer_pos) == TRUE)
-	    delivered = TRUE;
-#ifdef DEBUG
-	else
+	while_list(current, &g.PIPEWATCHERS)
 	{
-	    D_("plugin %s returned FALSE\n", current->from_file);
-	}
+		D_("Calling pipewatcher plugin.\n");
+		if ((*current->c.pipewatcher) (service, process, buffer_pos) == TRUE)
+			delivered = TRUE;
+#ifdef DEBUG
+		else
+		{
+			D_("plugin %s returned FALSE\n", current->from_file);
+		}
 #endif
-    }
+	}
 
-    /* make sure someone handled this */
-    if (delivered != TRUE)
-	fprintf(stdout, "%s", buffer_pos);
+	/* make sure someone handled this */
+	if (delivered != TRUE)
+		fprintf(stdout, "%s", buffer_pos);
 }
 
 
@@ -94,137 +94,137 @@
  */
 void initng_fd_process_read_input(active_db_h * service, process_h * p)
 {
-    char *read_pos = NULL;
-    int chars_read = 0;
-    int old_content_offset = 0;
-    int read_ret = 0;
-
-    D_("\ninitng_fd_process_read_input(%s, %s, %i);\n", service->name,
-       p->pt->name);
-
-    if (p->out_pipe[0] <= 0)
-    {
-	F_("FIFO, can't be read! NOT OPEN!\n");
-	return;
-    }
+	char *read_pos = NULL;
+	int chars_read = 0;
+	int old_content_offset = 0;
+	int read_ret = 0;
+
+	D_("\ninitng_fd_process_read_input(%s, %s, %i);\n", service->name,
+	   p->pt->name);
 
-    /* INITZIATE
-     * if this are not set to out_pipe, if there is nothing to read. read() will block.
-     * initng and sit down waiting for input.
-     */
-    if (p->buffer)
-    {
-	/* get the length of current data in buffer */
-	old_content_offset = strlen(p->buffer);
-    }
-    else
-    {
-	/* initziate buffer fnctl */
-	int fd_flags;
-
-	fd_flags = fcntl(p->out_pipe[0], F_GETFL, 0);
-	fcntl(p->out_pipe[0], F_SETFL, fd_flags | O_NONBLOCK);
-    }
-
-    /* read data from process, and continue again after a interrupt */
-    do
-    {
-	errno = 0;
-
-	/* OBSERVE, i_realloc may change the path to the data, so dont set buffer_pos to early */
-
-	/* Make sure there is room for 100 more chars */
-	D_("left: %i > %i\n", old_content_offset + chars_read + 100,
-	   p->buffer_allocated);
-	if (old_content_offset + chars_read + 100 > p->buffer_allocated)
-	{
-	    /* do a realloc */
-	    D_("Changing size of buffer %p to: %i\n", p->buffer,
-	       p->buffer_allocated + 100 + 1);
-	    char *tmp = i_realloc(p->buffer,
-				  (p->buffer_allocated + 100 +
-				   1) * sizeof(char));
-
-	    /* make sure realloc suceeded */
-	    if (tmp)
-	    {
-		D_("p->buffer changes from %p to %p.\n", p->buffer, tmp);
-		p->buffer = tmp;
-		p->buffer_allocated += 100;
-	    }
-	    else
-	    {
-		F_("realloc failed, possibly out of memory!\n");
+	if (p->out_pipe[0] <= 0)
+	{
+		F_("FIFO, can't be read! NOT OPEN!\n");
 		return;
-	    }
 	}
 
-	/* set read_pos to buffer + chars of old content + chars read so far */
-	read_pos = p->buffer + old_content_offset + chars_read;
+	/* INITZIATE
+	 * if this are not set to out_pipe, if there is nothing to read. read() will block.
+	 * initng and sit down waiting for input.
+	 */
+	if (p->buffer)
+	{
+		/* get the length of current data in buffer */
+		old_content_offset = strlen(p->buffer);
+	}
+	else
+	{
+		/* initziate buffer fnctl */
+		int fd_flags;
 
-	/* read the data */
-	D_("Reading 100 chars.\n");
-	read_ret = read(p->out_pipe[0], read_pos, 100);
-
-	D_("read_ret = %i\n", read_ret);
-	/* make sure read does not return -1 */
-	if (read_ret <= 0)
-	    break;
-
-	/* make sure its nulled at end */
-	read_pos[read_ret] = '\0';
-
-	/* increase read_pos */
-	chars_read += read_ret;
-    }
-    /* if read_ret == 100, it migit be more to read, or it got interrupted. */
-    while (read_ret >= 100 || errno == EINTR);
-
-    /* make sure there is any */
-    if (chars_read > 0)
-    {
-	/* let all plugin take part of data */
-	initng_fd_plugin_readpipe(service, p, p->buffer + old_content_offset);
-    }
-
-    /* if EOF close pipes */
-    if (read_ret == 0)
-    {
-	D_("Closing fifos for %s.\n", service->name);
-	if (p->out_pipe[0] > 0)
-	    close(p->out_pipe[0]);
-	if (p->out_pipe[1] > 0)
-	    close(p->out_pipe[1]);
-	p->out_pipe[0] = -1;
-	p->out_pipe[1] = -1;
-	return;
-    }
+		fd_flags = fcntl(p->out_pipe[0], F_GETFL, 0);
+		fcntl(p->out_pipe[0], F_SETFL, fd_flags | O_NONBLOCK);
+	}
+
+	/* read data from process, and continue again after a interrupt */
+	do
+	{
+		errno = 0;
+
+		/* OBSERVE, i_realloc may change the path to the data, so dont set buffer_pos to early */
+
+		/* Make sure there is room for 100 more chars */
+		D_("left: %i > %i\n", old_content_offset + chars_read + 100,
+		   p->buffer_allocated);
+		if (old_content_offset + chars_read + 100 > p->buffer_allocated)
+		{
+			/* do a realloc */
+			D_("Changing size of buffer %p to: %i\n", p->buffer,
+			   p->buffer_allocated + 100 + 1);
+			char *tmp = i_realloc(p->buffer,
+								  (p->buffer_allocated + 100 +
+								   1) * sizeof(char));
+
+			/* make sure realloc suceeded */
+			if (tmp)
+			{
+				D_("p->buffer changes from %p to %p.\n", p->buffer, tmp);
+				p->buffer = tmp;
+				p->buffer_allocated += 100;
+			}
+			else
+			{
+				F_("realloc failed, possibly out of memory!\n");
+				return;
+			}
+		}
+
+		/* set read_pos to buffer + chars of old content + chars read so far */
+		read_pos = p->buffer + old_content_offset + chars_read;
+
+		/* read the data */
+		D_("Reading 100 chars.\n");
+		read_ret = read(p->out_pipe[0], read_pos, 100);
+
+		D_("read_ret = %i\n", read_ret);
+		/* make sure read does not return -1 */
+		if (read_ret <= 0)
+			break;
+
+		/* make sure its nulled at end */
+		read_pos[read_ret] = '\0';
 
-    /* if buffer reached 10000 chars */
-    if (old_content_offset + chars_read > 10000)
-    {
-	char *tmp;
-
-	/* copy the string from 1000 chars, to first */
-	memmove(p->buffer, &p->buffer[1000], 9000 * sizeof(char));
-	/* rezise the buffer */
-	tmp = i_realloc(p->buffer, 9001 * sizeof(char));
-
-	/* make sure realloc suceeded */
-	if (tmp)
-	{
-	    p->buffer = tmp;
-	    p->buffer_allocated = 9000;
-	    p->buffer[9000] = '\0';
+		/* increase read_pos */
+		chars_read += read_ret;
 	}
-	else
+	/* if read_ret == 100, it migit be more to read, or it got interrupted. */
+	while (read_ret >= 100 || errno == EINTR);
+
+	/* make sure there is any */
+	if (chars_read > 0)
+	{
+		/* let all plugin take part of data */
+		initng_fd_plugin_readpipe(service, p, p->buffer + old_content_offset);
+	}
+
+	/* if EOF close pipes */
+	if (read_ret == 0)
+	{
+		D_("Closing fifos for %s.\n", service->name);
+		if (p->out_pipe[0] > 0)
+			close(p->out_pipe[0]);
+		if (p->out_pipe[1] > 0)
+			close(p->out_pipe[1]);
+		p->out_pipe[0] = -1;
+		p->out_pipe[1] = -1;
+		return;
+	}
+
+	/* if buffer reached 10000 chars */
+	if (old_content_offset + chars_read > 10000)
 	{
-	    /* make the best for the current situation */
-	    p->buffer[0] = '\0';
-	    F_("realloc failed, possibly out of memory!\n");
-	    return;
+		char *tmp;
+
+		/* copy the string from 1000 chars, to first */
+		memmove(p->buffer, &p->buffer[1000], 9000 * sizeof(char));
+		/* rezise the buffer */
+		tmp = i_realloc(p->buffer, 9001 * sizeof(char));
+
+		/* make sure realloc suceeded */
+		if (tmp)
+		{
+			p->buffer = tmp;
+			p->buffer_allocated = 9000;
+			p->buffer[9000] = '\0';
+		}
+		else
+		{
+			/* make the best for the current situation */
+			p->buffer[0] = '\0';
+			F_("realloc failed, possibly out of memory!\n");
+			return;
+		}
 	}
-    }
 }
 
 
@@ -247,168 +247,168 @@
  */
 void initng_fd_plugin_poll(int timeout)
 {
-    /* Variables */
-    fd_set readset, writeset, errset;
-    struct timeval tv;
-    int retval;
-    int added = 0;
-    active_db_h *currentA, *qA;
-    s_call *currentC, *qC;
-    process_h *currentP, *qP;
-
-    /* initialization */
-    S_;
-    FD_ZERO(&readset);
-    FD_ZERO(&writeset);
-    FD_ZERO(&errset);
-
-    /* Set timeval struct, to our timeout */
-    tv.tv_sec = timeout;
-    tv.tv_usec = 0;
-
-
-    /*
-     * STEP 1:  Scan for fds to add
-     */
-
-
-    /* scan through active plug-ins that have listening file descriptors, and add them */
-    currentC = NULL;
-    while_list(currentC, &g.FDWATCHERS)
-    {
-	/* first, some checking */
-	if (currentC->c.fdh->fds <= 2)
-	    continue;
-	if (!currentC->c.fdh->call_module)
-	    continue;
-
-	/*D_("adding fd #%i, from an call_db.\n", current->c.fdh->fds); */
-	if (currentC->c.fdh->what & FDW_READ)
-	    FD_SET(currentC->c.fdh->fds, &readset);
-	if (currentC->c.fdh->what & FDW_WRITE)
-	    FD_SET(currentC->c.fdh->fds, &writeset);
-	if (currentC->c.fdh->what & FDW_ERROR)
-	    FD_SET(currentC->c.fdh->fds, &errset);
-	added++;
-    }
-
-    /* Then add all file descriptors from process read pipes */
-    currentA = NULL;
-    while_active_db(currentA)
-    {
-	currentP = NULL;
-	while_processes(currentP, currentA)
-	{
-	    if (currentP->out_pipe[0] > 2)
-	    {
-		FD_SET(currentP->out_pipe[0], &readset);
+	/* Variables */
+	fd_set readset, writeset, errset;
+	struct timeval tv;
+	int retval;
+	int added = 0;
+	active_db_h *currentA, *qA;
+	s_call *currentC, *qC;
+	process_h *currentP, *qP;
+
+	/* initialization */
+	S_;
+	FD_ZERO(&readset);
+	FD_ZERO(&writeset);
+	FD_ZERO(&errset);
+
+	/* Set timeval struct, to our timeout */
+	tv.tv_sec = timeout;
+	tv.tv_usec = 0;
+
+
+	/*
+	 * STEP 1:  Scan for fds to add
+	 */
+
+
+	/* scan through active plug-ins that have listening file descriptors, and add them */
+	currentC = NULL;
+	while_list(currentC, &g.FDWATCHERS)
+	{
+		/* first, some checking */
+		if (currentC->c.fdh->fds <= 2)
+			continue;
+		if (!currentC->c.fdh->call_module)
+			continue;
+
+		/*D_("adding fd #%i, from an call_db.\n", current->c.fdh->fds); */
+		if (currentC->c.fdh->what & FDW_READ)
+			FD_SET(currentC->c.fdh->fds, &readset);
+		if (currentC->c.fdh->what & FDW_WRITE)
+			FD_SET(currentC->c.fdh->fds, &writeset);
+		if (currentC->c.fdh->what & FDW_ERROR)
+			FD_SET(currentC->c.fdh->fds, &errset);
 		added++;
-	    }
 	}
-    }
-
-
-    /*
-     * STEP 2: Do the select-poll, if any fds where added
-     */
-
-    /* check if there are any set */
-    if (added <= 0)
-    {
-	D_("No file descriptors set.\n");
-	sleep(timeout);
-	return;
-    }
-    D_("%i file descriptors added.\n", added);
 
-
-    /* make the select */
-    retval = select(256, &readset, &writeset, &errset, &tv);
+	/* Then add all file descriptors from process read pipes */
+	currentA = NULL;
+	while_active_db(currentA)
+	{
+		currentP = NULL;
+		while_processes(currentP, currentA)
+		{
+			if (currentP->out_pipe[0] > 2)
+			{
+				FD_SET(currentP->out_pipe[0], &readset);
+				added++;
+			}
+		}
+	}
 
 
-    /* error - Truly a interrupt */
-    if (retval < 0)
-    {
-	D_("Select returned %i\n", retval);
-	return;
-    }
+	/*
+	 * STEP 2: Do the select-poll, if any fds where added
+	 */
 
-    /* none was found */
-    if (retval == 0)
-    {
-	D_("There was no data found on any added fd.\n");
-	return;
-    }
+	/* check if there are any set */
+	if (added <= 0)
+	{
+		D_("No file descriptors set.\n");
+		sleep(timeout);
+		return;
+	}
+	D_("%i file descriptors added.\n", added);
 
-    D_("%d fd's active\n", retval);
 
-    /* If a fsck is running select will always return one file handler active, we give it 0.1 seconds to get some more data into the buffer. */
-    sleep(0.1);
+	/* make the select */
+	retval = select(256, &readset, &writeset, &errset, &tv);
 
 
-    /*
-     * STEP 3:  Find the plug-ins/processes that handles the fd input, and call them
-     */
+	/* error - Truly a interrupt */
+	if (retval < 0)
+	{
+		D_("Select returned %i\n", retval);
+		return;
+	}
 
-    /* Now scan through callers */
-    currentC = NULL;
-    qC = NULL;
-    while_list_safe(currentC, &g.FDWATCHERS, qC)
-    {
-	int what = 0;
+	/* none was found */
+	if (retval == 0)
+	{
+		D_("There was no data found on any added fd.\n");
+		return;
+	}
 
-	if (currentC->c.fdh->fds <= 2)
-	    continue;
-	if (!currentC->c.fdh->call_module)
-	    continue;
+	D_("%d fd's active\n", retval);
 
-	if (FD_ISSET(currentC->c.fdh->fds, &readset))
-	    what |= FDW_READ;
-	if (FD_ISSET(currentC->c.fdh->fds, &writeset))
-	    what |= FDW_WRITE;
-	if (FD_ISSET(currentC->c.fdh->fds, &errset))
-	    what |= FDW_ERROR;
+	/* If a fsck is running select will always return one file handler active, we give it 0.1 seconds to get some more data into the buffer. */
+	sleep(0.1);
 
-	if (what == 0)
-	    continue;
 
+	/*
+	 * STEP 3:  Find the plug-ins/processes that handles the fd input, and call them
+	 */
 
-	D_("Calling plugin handler for fd #%i, what=%i\n",
-	   currentC->c.fdh->fds, what);
-	(*currentC->c.fdh->call_module) (currentC->c.fdh, what);
-	D_("Call handler returned.\n");
+	/* Now scan through callers */
+	currentC = NULL;
+	qC = NULL;
+	while_list_safe(currentC, &g.FDWATCHERS, qC)
+	{
+		int what = 0;
 
-	/* Found match, that means we need to look for one less, if we've found all we should then return */
-	retval--;
-	if (retval == 0)
-	    return;
-    }
+		if (currentC->c.fdh->fds <= 2)
+			continue;
+		if (!currentC->c.fdh->call_module)
+			continue;
+
+		if (FD_ISSET(currentC->c.fdh->fds, &readset))
+			what |= FDW_READ;
+		if (FD_ISSET(currentC->c.fdh->fds, &writeset))
+			what |= FDW_WRITE;
+		if (FD_ISSET(currentC->c.fdh->fds, &errset))
+			what |= FDW_ERROR;
+
+		if (what == 0)
+			continue;
+
+
+		D_("Calling plugin handler for fd #%i, what=%i\n",
+		   currentC->c.fdh->fds, what);
+		(*currentC->c.fdh->call_module) (currentC->c.fdh, what);
+		D_("Call handler returned.\n");
 
-    /* scan every service */
-    currentA = NULL;
-    qA = NULL;
-    while_active_db_safe(currentA, qA)
-    {
-	currentP = NULL;
-	qP = NULL;
-	/* and all the processes */
-	while_processes_safe(currentP, qP, currentA)
-	{
-	    /* if matching */
-	    if (currentP->out_pipe[0] > 2
-		&& FD_ISSET(currentP->out_pipe[0], &readset))
-	    {
-		D_("Will read from %s->start_process on fd #%i\n",
-		   currentA->name, currentP->out_pipe[0]);
-		/* Do the actual read from pipe */
-		initng_fd_process_read_input(currentA, currentP);
 		/* Found match, that means we need to look for one less, if we've found all we should then return */
 		retval--;
 		if (retval == 0)
-		    return;
-	    }
+			return;
 	}
-    }
 
-    return;
+	/* scan every service */
+	currentA = NULL;
+	qA = NULL;
+	while_active_db_safe(currentA, qA)
+	{
+		currentP = NULL;
+		qP = NULL;
+		/* and all the processes */
+		while_processes_safe(currentP, qP, currentA)
+		{
+			/* if matching */
+			if (currentP->out_pipe[0] > 2
+				&& FD_ISSET(currentP->out_pipe[0], &readset))
+			{
+				D_("Will read from %s->start_process on fd #%i\n",
+				   currentA->name, currentP->out_pipe[0]);
+				/* Do the actual read from pipe */
+				initng_fd_process_read_input(currentA, currentP);
+				/* Found match, that means we need to look for one less, if we've found all we should then return */
+				retval--;
+				if (retval == 0)
+					return;
+			}
+		}
+	}
+
+	return;
 }

Modified: initng/trunk/src/initng_fork.c
==============================================================================
--- initng/trunk/src/initng_fork.c	(original)
+++ initng/trunk/src/initng_fork.c	Wed Apr  5 23:11:19 2006
@@ -20,12 +20,12 @@
 
 #include "initng.h"
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <unistd.h>			    /* execv() pipe() usleep() pause() chown() pid_t */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdlib.h>			    /* free() exit() */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <unistd.h>							/* execv() pipe() usleep() pause() chown() pid_t */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdlib.h>							/* free() exit() */
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
@@ -47,131 +47,131 @@
 
 pid_t initng_fork(active_db_h * service, process_h * process)
 {
-    /* This is the real service kicker */
-    pid_t pid_fork;		/* pid got from fork() */
-    int try_count = 0;		/* Count tryings */
-    s_call *current = NULL;
-
-    assert(service);
-    assert(process);
-
-    /* open pipe */
-    if (pipe(process->out_pipe) != 0)
-    {
-	F_("Failed adding pipe ! %s\n", strerror(errno));
-	return (-1);
-    }
-
-    /* alloc buffer */
-    if (process->buffer)
-    {
-	free(process->buffer);
-	process->buffer = NULL;
-	process->buffer_allocated = 0;
-    }
-
-
-    /* Try to fork 30 times */
-    while ((pid_fork = fork()) == -1)
-    {
-	if (try_count > 30)
-	{				    /* Already tried 30 times = no more try */
-	    F_("GIVING UP TRY TO FORK, FATAL for service.\n");
-	    return (pid_fork);
-	}
-	F_("FAILED TO FORK! try no# %i, this can be FATAL!\n", try_count);
-	usleep(++try_count * 2000);	    /* Sleep a while before trying again */
-    }
-
-    /* if this is child */
-    if (pid_fork == 0)
-    {
-	/* from now, don't trap signals */
-	initng_signal_disable();
-
-#ifdef DEBUG
-	/* unverbose by default for now */
-	/* g.verbose = 0; */
-#endif
-
+	/* This is the real service kicker */
+	pid_t pid_fork;				/* pid got from fork() */
+	int try_count = 0;			/* Count tryings */
+	s_call *current = NULL;
 
+	assert(service);
+	assert(process);
 
-	/* TODO, comment this */
-	if (g.i_am_init)
+	/* open pipe */
+	if (pipe(process->out_pipe) != 0)
 	{
-	    ioctl(0, TIOCNOTTY, 0);
-	    setsid();			    /* Run a program in a new session ??? */
+		F_("Failed adding pipe ! %s\n", strerror(errno));
+		return (-1);
 	}
 
-	/*
-	 * set up file descriptors, for local fork,
-	 * a fork in initng, should now receive any input, but stdout & stderr, should be sent
-	 * to process->out_pipe[], that is set up by pipe() #man 2 pipe
-	 * [0] for reading, and [1] for writing, as the pipe is for sending output
-	 * FROM the fork, to initng for handle, the input part should be closed here,
-	 * the other are mapped to STDOUT and STDERR.
-	 */
-
-	/* close stdin/stdout/stderr */
-	/*close(STDIN_FILENO); */
-	close(STDOUT_FILENO);
-	close(STDERR_FILENO);
-
-	/* Duplicate stdout and stderr to the stdout[1] */
-	dup2(process->out_pipe[1], STDOUT_FILENO);
-	dup2(process->out_pipe[1], STDERR_FILENO);
-
-	/* set stdin, stdout, and stderr, that is should not be closed, if this child do execve() */
-	fcntl(STDIN_FILENO, F_SETFD, 0);
-	fcntl(STDOUT_FILENO, F_SETFD, 0);
-	fcntl(STDERR_FILENO, F_SETFD, 0);
-
-	/* Close the sides of the pipes we don't need, as we're in fork we won't need this part. */
-	close(process->out_pipe[0]);
-	process->out_pipe[0] = -1;
-
+	/* alloc buffer */
+	if (process->buffer)
+	{
+		free(process->buffer);
+		process->buffer = NULL;
+		process->buffer_allocated = 0;
+	}
 
 
-	/* There might be plug-ins that will work here */
-	while_list(current, &g.A_FORK)
+	/* Try to fork 30 times */
+	while ((pid_fork = fork()) == -1)
 	{
-	    if (((*current->c.af_launcher) (service, process)) == FALSE)
-	    {
-		F_("Some plugin did fail (from:%s), in after fork launch.\n",
-		   current->from_file);
-		_exit(1);
-	    }
+		if (try_count > 30)
+		{									/* Already tried 30 times = no more try */
+			F_("GIVING UP TRY TO FORK, FATAL for service.\n");
+			return (pid_fork);
+		}
+		F_("FAILED TO FORK! try no# %i, this can be FATAL!\n", try_count);
+		usleep(++try_count * 2000);			/* Sleep a while before trying again */
 	}
 
-	/* close all open fds, except STDIN, STDOUT, STDERR (0, 1, 2) */
+	/* if this is child */
+	if (pid_fork == 0)
 	{
-	    int i;
+		/* from now, don't trap signals */
+		initng_signal_disable();
+
+#ifdef DEBUG
+		/* unverbose by default for now */
+		/* g.verbose = 0; */
+#endif
+
+
+
+		/* TODO, comment this */
+		if (g.i_am_init)
+		{
+			ioctl(0, TIOCNOTTY, 0);
+			setsid();						/* Run a program in a new session ??? */
+		}
+
+		/*
+		 * set up file descriptors, for local fork,
+		 * a fork in initng, should now receive any input, but stdout & stderr, should be sent
+		 * to process->out_pipe[], that is set up by pipe() #man 2 pipe
+		 * [0] for reading, and [1] for writing, as the pipe is for sending output
+		 * FROM the fork, to initng for handle, the input part should be closed here,
+		 * the other are mapped to STDOUT and STDERR.
+		 */
+
+		/* close stdin/stdout/stderr */
+		/*close(STDIN_FILENO); */
+		close(STDOUT_FILENO);
+		close(STDERR_FILENO);
+
+		/* Duplicate stdout and stderr to the stdout[1] */
+		dup2(process->out_pipe[1], STDOUT_FILENO);
+		dup2(process->out_pipe[1], STDERR_FILENO);
+
+		/* set stdin, stdout, and stderr, that is should not be closed, if this child do execve() */
+		fcntl(STDIN_FILENO, F_SETFD, 0);
+		fcntl(STDOUT_FILENO, F_SETFD, 0);
+		fcntl(STDERR_FILENO, F_SETFD, 0);
+
+		/* Close the sides of the pipes we don't need, as we're in fork we won't need this part. */
+		close(process->out_pipe[0]);
+		process->out_pipe[0] = -1;
 
-	    for (i = 3; i <= 1013; i++)
-		close(i);
-	}
 
-	/* TODO, what does this do? */
-	if (g.i_am_init)
-	    tcsetpgrp(0, getpgrp());	    /* run this in foreground on fd 0 */
-
-	/* do a minimum sleep, to let the mother process 
-	   to register child, and notice death */
-	usleep(ALL_USLEEP);
-
-    }
-    else
-    {
-
-	/* close the receiving end on pipe, on parent */
-	close(process->out_pipe[1]);
-	process->out_pipe[1] = -1;
-	if (pid_fork > 0)
+
+		/* There might be plug-ins that will work here */
+		while_list(current, &g.A_FORK)
+		{
+			if (((*current->c.af_launcher) (service, process)) == FALSE)
+			{
+				F_("Some plugin did fail (from:%s), in after fork launch.\n",
+				   current->from_file);
+				_exit(1);
+			}
+		}
+
+		/* close all open fds, except STDIN, STDOUT, STDERR (0, 1, 2) */
+		{
+			int i;
+
+			for (i = 3; i <= 1013; i++)
+				close(i);
+		}
+
+		/* TODO, what does this do? */
+		if (g.i_am_init)
+			tcsetpgrp(0, getpgrp());		/* run this in foreground on fd 0 */
+
+		/* do a minimum sleep, to let the mother process 
+		   to register child, and notice death */
+		usleep(ALL_USLEEP);
+
+	}
+	else
 	{
-	    process->pid = pid_fork;
-	    process->pst = P_RUNNING;
+
+		/* close the receiving end on pipe, on parent */
+		close(process->out_pipe[1]);
+		process->out_pipe[1] = -1;
+		if (pid_fork > 0)
+		{
+			process->pid = pid_fork;
+			process->pst = P_RUNNING;
+		}
 	}
-    }
 
-    return (pid_fork);
+	return (pid_fork);
 }

Modified: initng/trunk/src/initng_fork.h
==============================================================================
--- initng/trunk/src/initng_fork.h	(original)
+++ initng/trunk/src/initng_fork.h	Wed Apr  5 23:11:19 2006
@@ -20,9 +20,9 @@
 
 #ifndef INITNG_FORK_H
 #define INITNG_FORK_H
-#include <unistd.h>			    /* pid_t */
-#include "initng_active_db.h"		    /* active_h */
-#include "initng_process_db.h"		    /* process_h */
+#include <unistd.h>							/* pid_t */
+#include "initng_active_db.h"				/* active_h */
+#include "initng_process_db.h"				/* process_h */
 
 pid_t initng_fork(active_db_h * service, process_h * process);
 

Modified: initng/trunk/src/initng_global.c
==============================================================================
--- initng/trunk/src/initng_global.c	(original)
+++ initng/trunk/src/initng_global.c	Wed Apr  5 23:11:19 2006
@@ -37,121 +37,121 @@
 
 void initng_global_new(int argc, char *argv[], char *env[])
 {
-    int i;
+	int i;
 
-    assert(argv);
-    assert(env);
+	assert(argv);
+	assert(env);
 
-    /* zero the complete s_global */
-    memset(&g, 0, sizeof(s_global));
+	/* zero the complete s_global */
+	memset(&g, 0, sizeof(s_global));
 
-    /* we want to keep a copy of the arguments passed to us, this will be overwritten by set_title() */
-    g.Argc = argc;
-    g.Argv0 = argv[0];
-    g.Argv = (char **) i_calloc(argc + 1, sizeof(char *));
-    assert(g.Argv);
-
-    for (i = 0; i < argc; i++)
-    {
-	g.Argv[i] = i_strdup(argv[i]);
-	assert(g.Argv[i]);
-    }
-    g.Argv[argc] = NULL;
-
-    /* 
-     * We want to change our process name, because it looks nice in 
-     * "ps" output. But we can only use space that the kernel 
-     * allocated for us when we started. This is argv[] and env[] 
-     * together. 
-     */
-    g.maxproclen = 0;
-    for (i = 0; i < argc; i++)
-    {
-	g.maxproclen += strlen(argv[i]) + 1;
-    }
-    for (i = 0; env[i] != NULL; i++)
-    {
-	g.maxproclen += strlen(env[i]) + 1;
-    }
-    D_("Maximum length for our process name is %d\n", g.maxproclen);
-
-    /*
-     * initialize global data storage
-     */
-    DATA_HEAD_INIT(&g.data);
-
-    /*
-     * initialize all databases, next and prev have to point to own struct
-     */
-    INIT_LIST_HEAD(&g.active_database.list);
-    INIT_LIST_HEAD(&g.service_cache.list);
-    INIT_LIST_HEAD(&g.states.list);
-    INIT_LIST_HEAD(&g.ptypes.list);
-    INIT_LIST_HEAD(&g.module_db.list);
-    INIT_LIST_HEAD(&g.option_db.list);
-    INIT_LIST_HEAD(&g.command_db.list);
-    INIT_LIST_HEAD(&g.stypes.list);
-
-
-    /* all hooks to hook at */
-    INIT_LIST_HEAD(&g.ASTATUS_CHANGE.list);
-    INIT_LIST_HEAD(&g.PARSERS.list);
-    INIT_LIST_HEAD(&g.SWATCHERS.list);
-    INIT_LIST_HEAD(&g.FDWATCHERS.list);
-    INIT_LIST_HEAD(&g.PIPEWATCHERS.list);
-    INIT_LIST_HEAD(&g.SIGNAL.list);
-    INIT_LIST_HEAD(&g.MAIN.list);
-    INIT_LIST_HEAD(&g.A_FORK.list);
-    INIT_LIST_HEAD(&g.HANDLE_KILLED.list);
-    INIT_LIST_HEAD(&g.COMPENSATE_TIME.list);
-    INIT_LIST_HEAD(&g.ERR_MSG.list);
-    INIT_LIST_HEAD(&g.LAUNCH.list);
-    INIT_LIST_HEAD(&g.DEP_ON.list);
-    INIT_LIST_HEAD(&g.ADDITIONAL_PARSE.list);
-    INIT_LIST_HEAD(&g.DUMP_ACTIVE_DB.list);
-    INIT_LIST_HEAD(&g.RELOAD_ACTIVE_DB.list);
-    INIT_LIST_HEAD(&g.IS_CHANGE.list);
-    INIT_LIST_HEAD(&g.START_DEP_MET.list);
-    INIT_LIST_HEAD(&g.STOP_DEP_MET.list);
-    INIT_LIST_HEAD(&g.UP_MET.list);
-
-    /*
-     * default global variables - cleared by memset above
-     * g.interrupt = FALSE;
-     * g.sys_state = STATE_NULL;
-     * g.runlevel = NULL;
-     * g.dev_console = NULL;
-     * g.modules_to_unload = FALSE;
-     * g.hot_reload = FALSE;
-     */
-
-    /* Add defaults (static) to data_types */
-    initng_static_data_id_add_defaults();
-    /* Add static stats to g.states */
-    initng_static_states_add_default();
-    /* Add static stypes */
-    initng_service_add_static_stypes();
-
-    /* CLEARED by memset above 
-       #ifdef DEBUG
-       g.verbose = 0;
-       {
-       int i;
-
-       for (i = 0; i < MAX_VERBOSES; i++)
-       g.verbose_this[i] = NULL;
-       }
-       #endif
-     */
-
-    /* parse all options, set in argv */
-    initng_global_parse_argv(argv);
-
-
-    /*
-     * Always put interrupt true on the start.
-     */
-    g.interrupt = TRUE;
+	/* we want to keep a copy of the arguments passed to us, this will be overwritten by set_title() */
+	g.Argc = argc;
+	g.Argv0 = argv[0];
+	g.Argv = (char **) i_calloc(argc + 1, sizeof(char *));
+	assert(g.Argv);
+
+	for (i = 0; i < argc; i++)
+	{
+		g.Argv[i] = i_strdup(argv[i]);
+		assert(g.Argv[i]);
+	}
+	g.Argv[argc] = NULL;
+
+	/* 
+	 * We want to change our process name, because it looks nice in 
+	 * "ps" output. But we can only use space that the kernel 
+	 * allocated for us when we started. This is argv[] and env[] 
+	 * together. 
+	 */
+	g.maxproclen = 0;
+	for (i = 0; i < argc; i++)
+	{
+		g.maxproclen += strlen(argv[i]) + 1;
+	}
+	for (i = 0; env[i] != NULL; i++)
+	{
+		g.maxproclen += strlen(env[i]) + 1;
+	}
+	D_("Maximum length for our process name is %d\n", g.maxproclen);
+
+	/*
+	 * initialize global data storage
+	 */
+	DATA_HEAD_INIT(&g.data);
+
+	/*
+	 * initialize all databases, next and prev have to point to own struct
+	 */
+	INIT_LIST_HEAD(&g.active_database.list);
+	INIT_LIST_HEAD(&g.service_cache.list);
+	INIT_LIST_HEAD(&g.states.list);
+	INIT_LIST_HEAD(&g.ptypes.list);
+	INIT_LIST_HEAD(&g.module_db.list);
+	INIT_LIST_HEAD(&g.option_db.list);
+	INIT_LIST_HEAD(&g.command_db.list);
+	INIT_LIST_HEAD(&g.stypes.list);
+
+
+	/* all hooks to hook at */
+	INIT_LIST_HEAD(&g.ASTATUS_CHANGE.list);
+	INIT_LIST_HEAD(&g.PARSERS.list);
+	INIT_LIST_HEAD(&g.SWATCHERS.list);
+	INIT_LIST_HEAD(&g.FDWATCHERS.list);
+	INIT_LIST_HEAD(&g.PIPEWATCHERS.list);
+	INIT_LIST_HEAD(&g.SIGNAL.list);
+	INIT_LIST_HEAD(&g.MAIN.list);
+	INIT_LIST_HEAD(&g.A_FORK.list);
+	INIT_LIST_HEAD(&g.HANDLE_KILLED.list);
+	INIT_LIST_HEAD(&g.COMPENSATE_TIME.list);
+	INIT_LIST_HEAD(&g.ERR_MSG.list);
+	INIT_LIST_HEAD(&g.LAUNCH.list);
+	INIT_LIST_HEAD(&g.DEP_ON.list);
+	INIT_LIST_HEAD(&g.ADDITIONAL_PARSE.list);
+	INIT_LIST_HEAD(&g.DUMP_ACTIVE_DB.list);
+	INIT_LIST_HEAD(&g.RELOAD_ACTIVE_DB.list);
+	INIT_LIST_HEAD(&g.IS_CHANGE.list);
+	INIT_LIST_HEAD(&g.START_DEP_MET.list);
+	INIT_LIST_HEAD(&g.STOP_DEP_MET.list);
+	INIT_LIST_HEAD(&g.UP_MET.list);
+
+	/*
+	 * default global variables - cleared by memset above
+	 * g.interrupt = FALSE;
+	 * g.sys_state = STATE_NULL;
+	 * g.runlevel = NULL;
+	 * g.dev_console = NULL;
+	 * g.modules_to_unload = FALSE;
+	 * g.hot_reload = FALSE;
+	 */
+
+	/* Add defaults (static) to data_types */
+	initng_static_data_id_add_defaults();
+	/* Add static stats to g.states */
+	initng_static_states_add_default();
+	/* Add static stypes */
+	initng_service_add_static_stypes();
+
+	/* CLEARED by memset above 
+	   #ifdef DEBUG
+	   g.verbose = 0;
+	   {
+	   int i;
+
+	   for (i = 0; i < MAX_VERBOSES; i++)
+	   g.verbose_this[i] = NULL;
+	   }
+	   #endif
+	 */
+
+	/* parse all options, set in argv */
+	initng_global_parse_argv(argv);
+
+
+	/*
+	 * Always put interrupt true on the start.
+	 */
+	g.interrupt = TRUE;
 
 }
 
@@ -159,28 +159,28 @@
 
 static void initng_global_parse_argv(char **argv)
 {
-    int i;
+	int i;
 
-    for (i = 0; argv[i]; i++)
-    {
-	/* set opt to argv */
-	char *opt = argv[i];
-
-	/* don't parse options starting with an '+' */
-	if (opt[0] == '+')
-	    continue;
-	/*
-	 * if arg is --verbose, skip the two -- here, and start checking.
-	 * if arg is -verbose, skip and continue for loop.
-	 * if arg is verbose, check it below
-	 */
+	for (i = 0; argv[i]; i++)
+	{
+		/* set opt to argv */
+		char *opt = argv[i];
 
-	/* if its a double --, its ok */
-	if (opt[0] == '-' && opt[1] == '-')
-	    opt += 2;
-	/* but a single is not ! */
-	if (opt[0] == '-')
-	    continue;
+		/* don't parse options starting with an '+' */
+		if (opt[0] == '+')
+			continue;
+		/*
+		 * if arg is --verbose, skip the two -- here, and start checking.
+		 * if arg is -verbose, skip and continue for loop.
+		 * if arg is verbose, check it below
+		 */
+
+		/* if its a double --, its ok */
+		if (opt[0] == '-' && opt[1] == '-')
+			opt += 2;
+		/* but a single is not ! */
+		if (opt[0] == '-')
+			continue;
 
 
 #define R_L "runlevel="
@@ -189,69 +189,69 @@
 #define C_L "console="
 
 #ifdef DEBUG
-	if (strcmp(opt, "verbose") == 0)
-	    g.verbose = TRUE;
+		if (strcmp(opt, "verbose") == 0)
+			g.verbose = TRUE;
 #endif
-	if (strcmp(opt, "i_am_init") == 0)
-	    g.i_am_init = TRUE;
-	if (strcmp(opt, "hot_reload") == 0)
-	{
-	    D_(" Will start after a hot reload ...\n");
-	    g.hot_reload = TRUE;
-	}
-	if (strcmp(opt, "i_am_not_init") == 0)
-	    g.i_am_init = FALSE;
-
-	if (strcmp(opt, "no_circular") == 0)
-	    g.no_circular = TRUE;
-
-	/* the ones with a value */
-	if (strncmp(opt, R_L, strlen(R_L)) == 0)
-	    g.runlevel = i_strdup((opt) + strlen(R_L));
-	if (!g.runlevel && strncmp(opt, KR_L, strlen(KR_L)) == 0)
-	    g.runlevel = i_strdup((opt) + strlen(KR_L));
-	if (strncmp(opt, C_L, strlen(C_L)) == 0)
-	    g.dev_console = i_strdup((opt) + strlen(C_L));
+		if (strcmp(opt, "i_am_init") == 0)
+			g.i_am_init = TRUE;
+		if (strcmp(opt, "hot_reload") == 0)
+		{
+			D_(" Will start after a hot reload ...\n");
+			g.hot_reload = TRUE;
+		}
+		if (strcmp(opt, "i_am_not_init") == 0)
+			g.i_am_init = FALSE;
+
+		if (strcmp(opt, "no_circular") == 0)
+			g.no_circular = TRUE;
+
+		/* the ones with a value */
+		if (strncmp(opt, R_L, strlen(R_L)) == 0)
+			g.runlevel = i_strdup((opt) + strlen(R_L));
+		if (!g.runlevel && strncmp(opt, KR_L, strlen(KR_L)) == 0)
+			g.runlevel = i_strdup((opt) + strlen(KR_L));
+		if (strncmp(opt, C_L, strlen(C_L)) == 0)
+			g.dev_console = i_strdup((opt) + strlen(C_L));
 #ifdef DEBUG
-	if (strncmp(opt, V_T, strlen(V_T)) == 0)
-	    initng_error_verbose_add((opt) + strlen(V_T));
+		if (strncmp(opt, V_T, strlen(V_T)) == 0)
+			initng_error_verbose_add((opt) + strlen(V_T));
 #endif
-    }
+	}
 }
 
 void initng_global_free(void)
 {
-    int i;
+	int i;
+
+	/* free all databases */
+	initng_active_db_free_all();			/* clean process_db */
+	initng_service_cache_free_all();		/* clean service_cache_db */
+	initng_service_data_types_free_all();	/* clean option_db */
+	initng_command_free_all();				/* clean command_db */
+
+	/* free dynamic global variables */
+	dfree_all(&g);
+
+	/* free runlevel name string */
+	if (g.runlevel)
+		free(g.runlevel);
+
+	/* free console string if set */
+	if (g.dev_console)
+		free(g.dev_console);
 
-    /* free all databases */
-    initng_active_db_free_all();	    /* clean process_db */
-    initng_service_cache_free_all();	    /* clean service_cache_db */
-    initng_service_data_types_free_all();   /* clean option_db */
-    initng_command_free_all();		    /* clean command_db */
-
-    /* free dynamic global variables */
-    dfree_all(&g);
-
-    /* free runlevel name string */
-    if (g.runlevel)
-	free(g.runlevel);
-
-    /* free console string if set */
-    if (g.dev_console)
-	free(g.dev_console);
-
-    /* free our copy of argv, and argc */
-    for (i = 0; i < g.Argc; i++)
-    {
-	free(g.Argv[i]);
-    }
-    free(g.Argv);
-
-
-    /* close all open fd, over 3, this may hang boot */
-    for (i = 3; i <= 1013; i++)
-    {
-	close(i);
-    }
+	/* free our copy of argv, and argc */
+	for (i = 0; i < g.Argc; i++)
+	{
+		free(g.Argv[i]);
+	}
+	free(g.Argv);
+
+
+	/* close all open fd, over 3, this may hang boot */
+	for (i = 3; i <= 1013; i++)
+	{
+		close(i);
+	}
 
 }

Modified: initng/trunk/src/initng_global.h
==============================================================================
--- initng/trunk/src/initng_global.h	(original)
+++ initng/trunk/src/initng_global.h	Wed Apr  5 23:11:19 2006
@@ -33,98 +33,98 @@
 /* what to do when last process stops */
 typedef enum
 {
-    THEN_NONE = 0,
-    THEN_QUIT = 1,
-    THEN_RESTART = 2,
-    THEN_SULOGIN = 3,
-    THEN_NEW_INIT = 4,
-    THEN_HALT = 5,
-    THEN_REBOOT = 6,
-    THEN_POWEROFF = 7,
+	THEN_NONE = 0,
+	THEN_QUIT = 1,
+	THEN_RESTART = 2,
+	THEN_SULOGIN = 3,
+	THEN_NEW_INIT = 4,
+	THEN_HALT = 5,
+	THEN_REBOOT = 6,
+	THEN_POWEROFF = 7,
 } h_then;
 
 
 /* The GLOBAL struct */
 typedef struct
 {
-    /* all the databases */
-    service_cache_h service_cache;
-    active_db_h active_database;
-    a_state_h states;
-    ptype_h ptypes;
-    m_h module_db;
-    s_entry option_db;
-    s_command command_db;
-    stype_h stypes;
-
-    /* global options */
-    data_head data;
-
-    /* all hooks to hook at */
-    s_call ASTATUS_CHANGE;	/* Calls as soon as the ASTATUS changes */
-    s_call PARSERS;		/* Called when a service needs its data */
-    s_call ADDITIONAL_PARSE;	/* Called after a service been parsed, and extra parsing may exist */
-    s_call SWATCHERS;		/* Called when system state changes */
-    s_call FDWATCHERS;		/* Called when initng open file descriptors receive data */
-    s_call PIPEWATCHERS;	/* Called when a service has some output, that initng received */
-    s_call SIGNAL;		/* Called when initng rescives a signal, like SIGHUP */
-    s_call MAIN;		/* Called every main loop */
-    s_call A_FORK;		/* Called after a process forks to start */
-    s_call HANDLE_KILLED;	/* Called when a process dies */
-    s_call COMPENSATE_TIME;	/* Called when initng detects a system time change */
-    s_call ERR_MSG;		/* Called when an error message is sent, so all output plug-ins can show it */
-    s_call LAUNCH;		/* Called when a process are getting launched */
-    s_call DUMP_ACTIVE_DB;	/* Asks for a plugin willing to dump the acytive_db */
-    s_call RELOAD_ACTIVE_DB;	/* Asks for a plugin willing to reload the active_db from a dump */
-    s_call DEP_ON;		/* Called when a function tries to find out a service dependency */
-
-    /* new ones */
-    s_call IS_CHANGE;		/* Called when the rough state of a service changes */
-    s_call START_DEP_MET;	/* Called and all this hooks have to return TRUE for launch to start */
-    s_call STOP_DEP_MET;	/* Called and all this hooks have to return TRUE for the service to stop */
-    s_call UP_MET;		/* Called when a service is trying to set the RUNNING state, is a up test */
-
-
-    /* global variables */
-    h_sys_state sys_state;
-    volatile int interrupt;
-    int modules_to_unload;
-
-    /* time counters */
-    struct timeval now;
-    int sleep_seconds;
-
-    /* Argument data */
-    char **Argv;
-    int Argc;
-    int maxproclen;
-    char *Argv0;
-
-    /* system state data */
-    int i_am_init;
-    int hot_reload;
-    char *runlevel;
-    char *old_runlevel;
-    char *dev_console;
-    int when_out;
-
-    /* next alarm */
-    time_t next_alarm;
-
-    /* use with THEN_NEW_INIT */
-    char **new_init;
-    int no_circular;
+	/* all the databases */
+	service_cache_h service_cache;
+	active_db_h active_database;
+	a_state_h states;
+	ptype_h ptypes;
+	m_h module_db;
+	s_entry option_db;
+	s_command command_db;
+	stype_h stypes;
+
+	/* global options */
+	data_head data;
+
+	/* all hooks to hook at */
+	s_call ASTATUS_CHANGE;		/* Calls as soon as the ASTATUS changes */
+	s_call PARSERS;				/* Called when a service needs its data */
+	s_call ADDITIONAL_PARSE;	/* Called after a service been parsed, and extra parsing may exist */
+	s_call SWATCHERS;			/* Called when system state changes */
+	s_call FDWATCHERS;			/* Called when initng open file descriptors receive data */
+	s_call PIPEWATCHERS;		/* Called when a service has some output, that initng received */
+	s_call SIGNAL;				/* Called when initng rescives a signal, like SIGHUP */
+	s_call MAIN;				/* Called every main loop */
+	s_call A_FORK;				/* Called after a process forks to start */
+	s_call HANDLE_KILLED;		/* Called when a process dies */
+	s_call COMPENSATE_TIME;		/* Called when initng detects a system time change */
+	s_call ERR_MSG;				/* Called when an error message is sent, so all output plug-ins can show it */
+	s_call LAUNCH;				/* Called when a process are getting launched */
+	s_call DUMP_ACTIVE_DB;		/* Asks for a plugin willing to dump the acytive_db */
+	s_call RELOAD_ACTIVE_DB;	/* Asks for a plugin willing to reload the active_db from a dump */
+	s_call DEP_ON;				/* Called when a function tries to find out a service dependency */
+
+	/* new ones */
+	s_call IS_CHANGE;			/* Called when the rough state of a service changes */
+	s_call START_DEP_MET;		/* Called and all this hooks have to return TRUE for launch to start */
+	s_call STOP_DEP_MET;		/* Called and all this hooks have to return TRUE for the service to stop */
+	s_call UP_MET;				/* Called when a service is trying to set the RUNNING state, is a up test */
+
+
+	/* global variables */
+	h_sys_state sys_state;
+	volatile int interrupt;
+	int modules_to_unload;
+
+	/* time counters */
+	struct timeval now;
+	int sleep_seconds;
+
+	/* Argument data */
+	char **Argv;
+	int Argc;
+	int maxproclen;
+	char *Argv0;
+
+	/* system state data */
+	int i_am_init;
+	int hot_reload;
+	char *runlevel;
+	char *old_runlevel;
+	char *dev_console;
+	int when_out;
+
+	/* next alarm */
+	time_t next_alarm;
+
+	/* use with THEN_NEW_INIT */
+	char **new_init;
+	int no_circular;
 
 
 #ifdef DEBUG
-    /* g.verbose_this
-       0 = no verbose
-       1 = all verbose
-       2 = verbose whats in verbose_this
-       3 = verbose all but, that is %this in verbose_this
-     */
-    int verbose;
-    char *verbose_this[MAX_VERBOSES];
+	/* g.verbose_this
+	   0 = no verbose
+	   1 = all verbose
+	   2 = verbose whats in verbose_this
+	   3 = verbose all but, that is %this in verbose_this
+	 */
+	int verbose;
+	char *verbose_this[MAX_VERBOSES];
 #endif
 
 } s_global;

Modified: initng/trunk/src/initng_handler.c
==============================================================================
--- initng/trunk/src/initng_handler.c	(original)
+++ initng/trunk/src/initng_handler.c	Wed Apr  5 23:11:19 2006
@@ -21,15 +21,15 @@
 #include "initng.h"
 
 #include <sys/time.h>
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdio.h>			    /* printf() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdio.h>							/* printf() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <assert.h>
 #include <errno.h>
 
@@ -51,37 +51,37 @@
 
 void initng_handler_restart_restarting(void)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* make sure there is no more restarting running or stopping */
-    while_active_db(current)
-    {
-	if (IS_STOPPING(current))
+	/* make sure there is no more restarting running or stopping */
+	while_active_db(current)
 	{
-	    if (is(&RESTARTING, current))
-		return;
+		if (IS_STOPPING(current))
+		{
+			if (is(&RESTARTING, current))
+				return;
+		}
 	}
-    }
 
-    /* Okey, there was no stopping restart marked services. */
+	/* Okey, there was no stopping restart marked services. */
 
 
-    /* okay, now restart all RESTARTING services, that are STOPPED */
-    current = NULL;
-    while_active_db(current)
-    {
-	if (IS_DOWN(current))
+	/* okay, now restart all RESTARTING services, that are STOPPED */
+	current = NULL;
+	while_active_db(current)
 	{
-	    if (is(&RESTARTING, current))
-	    {
-		/* remove the restarting flag */
-		dfree(&RESTARTING, current);
-
-		/* start the service */
-		initng_handler_start_service(current);
-	    }
+		if (IS_DOWN(current))
+		{
+			if (is(&RESTARTING, current))
+			{
+				/* remove the restarting flag */
+				dfree(&RESTARTING, current);
+
+				/* start the service */
+				initng_handler_start_service(current);
+			}
+		}
 	}
-    }
 }
 
 /*
@@ -90,20 +90,20 @@
  */
 void initng_handler_run_interrupt_handlers(void)
 {
-    active_db_h *current, *q = NULL;
+	active_db_h *current, *q = NULL;
+
+	S_;
 
-    S_;
+	/* walk through all active services */
+	while_active_db_safe(current, q)
+	{
+		assert(current->name);
+		assert(current->current_state);
 
-    /* walk through all active services */
-    while_active_db_safe(current, q)
-    {
-	assert(current->name);
-	assert(current->current_state);
-
-	/* call state handler, now when we got an g.interrupt */
-	if (current->current_state->state_interrupt)
-	    (*current->current_state->state_interrupt) (current);
-    }
+		/* call state handler, now when we got an g.interrupt */
+		if (current->current_state->state_interrupt)
+			(*current->current_state->state_interrupt) (current);
+	}
 }
 
 /*
@@ -112,216 +112,216 @@
  */
 void initng_handler_run_alarm(void)
 {
-    active_db_h *current, *q = NULL;
+	active_db_h *current, *q = NULL;
 
-    S_;
+	S_;
 
-    /* reset next_alarm */
-    g.next_alarm = 0;
+	/* reset next_alarm */
+	g.next_alarm = 0;
 
-    /* walk through all active services */
-    while_active_db_safe(current, q)
-    {
-	assert(current->name);
-	assert(current->current_state);
+	/* walk through all active services */
+	while_active_db_safe(current, q)
+	{
+		assert(current->name);
+		assert(current->current_state);
+
+		/* skip services where alarm is not set */
+		if (current->alarm == 0)
+			continue;
+
+		/* if alarm has gone */
+		if (g.now.tv_sec >= current->alarm)
+		{
+			/* reset alarm */
+			current->alarm = 0;
+
+
+			/* call alarm handler, now when we got an g.interrupt */
+			if (current->current_state->state_alarm)
+				(*current->current_state->state_alarm) (current);
+			continue;
+		}
+
+		/* if no next_to_get is set */
+		if (!g.next_alarm)
+		{
+			g.next_alarm = current->alarm;
+			continue;
+		}
+
+		/* if this alarm is more early then next_to_get set it. */
+		if (current->alarm < g.next_alarm)
+		{
+			g.next_alarm = current->alarm;
+		}
+	}
+}
 
-	/* skip services where alarm is not set */
-	if (current->alarm == 0)
-	    continue;
+	/* M A R K    S T U F F */
 
-	/* if alarm has gone */
-	if (g.now.tv_sec >= current->alarm)
+	/* When this function is called, the service is marked for starting */
+int initng_handler_start_service(active_db_h * service_to_start)
+{
+	assert(service_to_start);
+	assert(service_to_start->name);
+	assert(service_to_start->current_state);
+
+	D_("start_service(%s);\n", service_to_start->name);
+
+	if (!service_to_start->type)
 	{
-	    /* reset alarm */
-	    current->alarm = 0;
+		F_("Type for service %s not set.\n", service_to_start->name);
+		return (FALSE);
+	}
 
+	/* check system state, if we can launch. */
+	if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
+	{
+		F_("Can't start service %s, when system status is: %i !\n",
+		   service_to_start->name, g.sys_state);
+		return (FALSE);
+	}
 
-	    /* call alarm handler, now when we got an g.interrupt */
-	    if (current->current_state->state_alarm)
-		(*current->current_state->state_alarm) (current);
-	    continue;
+	/* else, mark the service for restarting and stop it */
+	if (is(&RESTARTING, service_to_start))
+	{
+		D_("Cant manually start a service that is restarting.\n");
+		return (FALSE);
 	}
 
-	/* if no next_to_get is set */
-	if (!g.next_alarm)
+	/* it might already be starting */
+	if (IS_STARTING(service_to_start) || IS_WAITING(service_to_start))
 	{
-	    g.next_alarm = current->alarm;
-	    continue;
+		D_("service %s is starting already.\n", service_to_start->name);
+		return (TRUE);
 	}
 
-	/* if this alarm is more early then next_to_get set it. */
-	if (current->alarm < g.next_alarm)
+	/* if it failed */
+	if (IS_FAILED(service_to_start))
 	{
-	    g.next_alarm = current->alarm;
+		F_("Service %s failed and must be reset before it can be started again!\n", service_to_start->name);
+		return (FALSE);
 	}
-    }
-}
 
-    /* M A R K    S T U F F */
+	/* it might already be up */
+	if (IS_UP(service_to_start))
+	{
+		D_("service %s is already up!\n", service_to_start->name);
+		return (TRUE);
+	}
 
-    /* When this function is called, the service is marked for starting */
-int initng_handler_start_service(active_db_h * service_to_start)
-{
-    assert(service_to_start);
-    assert(service_to_start->name);
-    assert(service_to_start->current_state);
-
-    D_("start_service(%s);\n", service_to_start->name);
-
-    if (!service_to_start->type)
-    {
-	F_("Type for service %s not set.\n", service_to_start->name);
-	return (FALSE);
-    }
-
-    /* check system state, if we can launch. */
-    if (g.sys_state != STATE_STARTING && g.sys_state != STATE_UP)
-    {
-	F_("Can't start service %s, when system status is: %i !\n",
-	   service_to_start->name, g.sys_state);
-	return (FALSE);
-    }
-
-    /* else, mark the service for restarting and stop it */
-    if (is(&RESTARTING, service_to_start))
-    {
-	D_("Cant manually start a service that is restarting.\n");
-	return (FALSE);
-    }
-
-    /* it might already be starting */
-    if (IS_STARTING(service_to_start) || IS_WAITING(service_to_start))
-    {
-	D_("service %s is starting already.\n", service_to_start->name);
-	return (TRUE);
-    }
+	/* it must be down or stopping to start it */
+	if (!(IS_DOWN(service_to_start) || IS_STOPPING(service_to_start)))
+	{
+		W_("Can't set a service with status %s, to start\n",
+		   service_to_start->current_state->state_name);
+		return (FALSE);
+	}
 
-    /* if it failed */
-    if (IS_FAILED(service_to_start))
-    {
-	F_("Service %s failed and must be reset before it can be started again!\n", service_to_start->name);
-	return (FALSE);
-    }
-
-    /* it might already be up */
-    if (IS_UP(service_to_start))
-    {
-	D_("service %s is already up!\n", service_to_start->name);
-	return (TRUE);
-    }
+	/* This will run this functuin (start_service) for all dependecys this service have. */
+	if (initng_depend_start_deps(service_to_start) != TRUE)
+	{
+		F_("Could not start %s, because a required dependency could not be found.\n");
+		return (FALSE);
+	}
 
-    /* it must be down or stopping to start it */
-    if (!(IS_DOWN(service_to_start) || IS_STOPPING(service_to_start)))
-    {
-	W_("Can't set a service with status %s, to start\n",
-	   service_to_start->current_state->state_name);
-	return (FALSE);
-    }
-
-    /* This will run this functuin (start_service) for all dependecys this service have. */
-    if (initng_depend_start_deps(service_to_start) != TRUE)
-    {
-	F_("Could not start %s, because a required dependency could not be found.\n");
-	return (FALSE);
-    }
-
-    /* Now execute the local start_service code, in the service type plugin. */
-    if (!service_to_start->type->start_service)
-	return (FALSE);
+	/* Now execute the local start_service code, in the service type plugin. */
+	if (!service_to_start->type->start_service)
+		return (FALSE);
 
-    /* execute it */
-    return ((*service_to_start->type->start_service) (service_to_start));
+	/* execute it */
+	return ((*service_to_start->type->start_service) (service_to_start));
 }
 
-    /* S T O P     S E R V I C E */
+	/* S T O P     S E R V I C E */
 int initng_handler_stop_service(active_db_h * service_to_stop)
 {
 
-    assert(service_to_stop);
-    assert(service_to_stop->name);
-    assert(service_to_stop->current_state);
-
-    D_("stop_service(%s);\n", service_to_stop->name);
-
-    if (!service_to_stop->type)
-    {
-	F_("Service %s type is missing!\n", service_to_stop->name);
-	return (FALSE);
-    }
-
-    /* check so it not failed */
-    if (IS_FAILED(service_to_stop))
-    {
-	D_("Service %s is set filed, and cant be stopped.\n",
-	   service_to_stop->name);
-	return (TRUE);
-    }
+	assert(service_to_stop);
+	assert(service_to_stop->name);
+	assert(service_to_stop->current_state);
 
-    /* IF service is stopping, do nothing. */
-    if (IS_STOPPING(service_to_stop))
-    {
-	D_("service %s is stopping already!\n", service_to_stop->name);
-	return (TRUE);
-    }
+	D_("stop_service(%s);\n", service_to_stop->name);
 
-    /* check if its currently already down */
-    if (IS_DOWN(service_to_stop))
-    {
-	D_("Service %s is down already.\n", service_to_stop->name);
-	return (TRUE);
-    }
+	if (!service_to_stop->type)
+	{
+		F_("Service %s type is missing!\n", service_to_stop->name);
+		return (FALSE);
+	}
+
+	/* check so it not failed */
+	if (IS_FAILED(service_to_stop))
+	{
+		D_("Service %s is set filed, and cant be stopped.\n",
+		   service_to_stop->name);
+		return (TRUE);
+	}
+
+	/* IF service is stopping, do nothing. */
+	if (IS_STOPPING(service_to_stop))
+	{
+		D_("service %s is stopping already!\n", service_to_stop->name);
+		return (TRUE);
+	}
+
+	/* check if its currently already down */
+	if (IS_DOWN(service_to_stop))
+	{
+		D_("Service %s is down already.\n", service_to_stop->name);
+		return (TRUE);
+	}
+
+	/* must be up or starting, to stop */
+	if (!(IS_UP(service_to_stop) || IS_STARTING(service_to_stop)))
+	{
+		W_("Service %s is not up but %s, and cant be stopped.\n",
+		   service_to_stop->name, service_to_stop->current_state->state_name);
+
+		return (FALSE);
+	}
 
-    /* must be up or starting, to stop */
-    if (!(IS_UP(service_to_stop) || IS_STARTING(service_to_stop)))
-    {
-	W_("Service %s is not up but %s, and cant be stopped.\n",
-	   service_to_stop->name, service_to_stop->current_state->state_name);
-
-	return (FALSE);
-    }
-
-    /* if stop_service code is included in type, use it. */
-    if (!service_to_stop->type->stop_service)
-    {
-	W_("Service %s Type %s  has no stopper, will return FALSE!\n",
-	   service_to_stop->name, service_to_stop->type->name);
-	return (FALSE);
-    }
+	/* if stop_service code is included in type, use it. */
+	if (!service_to_stop->type->stop_service)
+	{
+		W_("Service %s Type %s  has no stopper, will return FALSE!\n",
+		   service_to_stop->name, service_to_stop->type->name);
+		return (FALSE);
+	}
 
 
-    return ((*service_to_stop->type->stop_service) (service_to_stop));
+	return ((*service_to_stop->type->stop_service) (service_to_stop));
 }
 
 int initng_handler_restart_service(active_db_h * service_to_restart)
 {
-    S_;
-    assert(service_to_restart);
-    assert(service_to_restart->name);
-    assert(service_to_restart->current_state);
-
-    /* type has to be known to restart the service */
-    if (!service_to_restart->type)
-	return (FALSE);
-
-    if (!IS_UP(service_to_restart))
-    {
-	D_("Can only restart a running service %s. ( now_state : %s )\n",
-	   service_to_restart->name,
-	   service_to_restart->current_state->state_name);
-	return (FALSE);
-    }
-
-    /* Restart all dependencys to this service */
-    initng_depend_restart_deps(service_to_restart);
-
-    /* if there exits a restart code, use it */
-    if (service_to_restart->type->restart_service)
-	return ((*service_to_restart->type->
-		 restart_service) (service_to_restart));
-
-    /* else, mark the service for restarting and stop it */
-    set(&RESTARTING, service_to_restart);
-    return (initng_handler_stop_service(service_to_restart));
+	S_;
+	assert(service_to_restart);
+	assert(service_to_restart->name);
+	assert(service_to_restart->current_state);
+
+	/* type has to be known to restart the service */
+	if (!service_to_restart->type)
+		return (FALSE);
+
+	if (!IS_UP(service_to_restart))
+	{
+		D_("Can only restart a running service %s. ( now_state : %s )\n",
+		   service_to_restart->name,
+		   service_to_restart->current_state->state_name);
+		return (FALSE);
+	}
+
+	/* Restart all dependencys to this service */
+	initng_depend_restart_deps(service_to_restart);
+
+	/* if there exits a restart code, use it */
+	if (service_to_restart->type->restart_service)
+		return ((*service_to_restart->type->
+				 restart_service) (service_to_restart));
+
+	/* else, mark the service for restarting and stop it */
+	set(&RESTARTING, service_to_restart);
+	return (initng_handler_stop_service(service_to_restart));
 }
 
 
@@ -329,58 +329,58 @@
 /* Load new process named */
 active_db_h *initng_handler_start_new_service_named(const char *service)
 {
-    active_db_h *to_load = NULL;
+	active_db_h *to_load = NULL;
 
-    D_(" start_new_service_named(%s);\n", service);
+	D_(" start_new_service_named(%s);\n", service);
 
-    assert(service);
+	assert(service);
 
-    /* Try to find it */
-    if ((to_load = initng_active_db_find_by_name(service)))
-    {
-	if (!IS_DOWN(to_load))
+	/* Try to find it */
+	if ((to_load = initng_active_db_find_by_name(service)))
 	{
-	    D_("Service %s exits already, and is not stopped!\n",
-	       to_load->name);
-	    return (to_load);
-	}
+		if (!IS_DOWN(to_load))
+		{
+			D_("Service %s exits already, and is not stopped!\n",
+			   to_load->name);
+			return (to_load);
+		}
 
-    }
-    /* else try create and load a new service */
-    else if (!(to_load = initng_common_load_to_active(service)))
-    {
+	}
+	/* else try create and load a new service */
+	else if (!(to_load = initng_common_load_to_active(service)))
+	{
 
-	/* the function calling this function will print out an error */
-	D_("Unable to load active for service %s\n", service);
-	return (NULL);
-    }
+		/* the function calling this function will print out an error */
+		D_("Unable to load active for service %s\n", service);
+		return (NULL);
+	}
 
-    /* okay, now start it */
-    initng_handler_start_service(to_load);
+	/* okay, now start it */
+	initng_handler_start_service(to_load);
 
-    return (to_load);
+	return (to_load);
 }
 
 /* enter a new runlevel */
 int initng_handler_stop_all(void)
 {
-    active_db_h *ser, *q = NULL;
+	active_db_h *ser, *q = NULL;
 
-    S_;
-    initng_main_set_sys_state(STATE_STOPPING);
+	S_;
+	initng_main_set_sys_state(STATE_STOPPING);
 
-    while_active_db_safe(ser, q)
-    {
-	/* don't stop a stopping service */
-	if (IS_STOPPING(ser))
-	    continue;
-	if (IS_DOWN(ser))
-	    continue;
-	if (IS_FAILED(ser))
-	    continue;
-
-	/* stop services */
-	initng_handler_stop_service(ser);
-    }
-    return (TRUE);
+	while_active_db_safe(ser, q)
+	{
+		/* don't stop a stopping service */
+		if (IS_STOPPING(ser))
+			continue;
+		if (IS_DOWN(ser))
+			continue;
+		if (IS_FAILED(ser))
+			continue;
+
+		/* stop services */
+		initng_handler_stop_service(ser);
+	}
+	return (TRUE);
 }

Modified: initng/trunk/src/initng_is.h
==============================================================================
--- initng/trunk/src/initng_is.h	(original)
+++ initng/trunk/src/initng_is.h	Wed Apr  5 23:11:19 2006
@@ -24,13 +24,13 @@
 
 typedef enum
 {
-    IS_UNKNOWN = 0,
-    IS_UP = 1,
-    IS_DOWN = 2,
-    IS_FAILED = 3,
-    IS_STARTING = 4,
-    IS_STOPPING = 5,
-    IS_WAITING = 6
+	IS_UNKNOWN = 0,
+	IS_UP = 1,
+	IS_DOWN = 2,
+	IS_FAILED = 3,
+	IS_STARTING = 4,
+	IS_STOPPING = 5,
+	IS_WAITING = 6
 } e_is;
 
 #define IS_MARK(serv, state) (serv && serv->current_state && serv->current_state == state)

Modified: initng/trunk/src/initng_kill_handler.c
==============================================================================
--- initng/trunk/src/initng_kill_handler.c	(original)
+++ initng/trunk/src/initng_kill_handler.c	Wed Apr  5 23:11:19 2006
@@ -20,15 +20,15 @@
 
 #include "initng.h"
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdio.h>			    /* printf() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdio.h>							/* printf() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <assert.h>
 
 #include "initng_global.h"
@@ -54,83 +54,83 @@
 /* called when a process got killed, identify it, and make a call with a pointer to the process */
 void initng_kill_handler_killed_by_pid(pid_t kpid, int r_code)
 {
-    /* The process that got killed */
-    active_db_h *service = NULL;
-    process_h *process = NULL;
+	/* The process that got killed */
+	active_db_h *service = NULL;
+	process_h *process = NULL;
+
+	D_("handle_killed_by_pid(%i);\n", kpid);
+
+	/* don't do anything on this pid */
+	if (kpid <= 1)
+		return;
+
+	/* Look in process database for a match */
+	if (!(service = initng_active_db_find_by_pid(kpid)))
+	{
+		D_("handle_killed_by_pid(%i): No match in active_db!\n", kpid);
+		return;
+	}
+
+	D_("handle_killed_by_pid(%i): found service \"%s\"...\n", kpid,
+	   service->name);
+
+	/* Get the process pointer from the service */
+	if (!(process = initng_process_db_get_by_pid(kpid, service)))
+	{
+		W_("Could not fetch process, even when initng_active_db_find_by_pid() saw it here!\n");
+		return;
+	}
 
-    D_("handle_killed_by_pid(%i);\n", kpid);
+	D_("(%i), found process type: %s\n", kpid, process->pt->name);
 
-    /* don't do anything on this pid */
-    if (kpid <= 1)
-	return;
 
-    /* Look in process database for a match */
-    if (!(service = initng_active_db_find_by_pid(kpid)))
-    {
-	D_("handle_killed_by_pid(%i): No match in active_db!\n", kpid);
-	return;
-    }
+	/* set r_code */
+	process->r_code = r_code;
 
-    D_("handle_killed_by_pid(%i): found service \"%s\"...\n", kpid,
-       service->name);
-
-    /* Get the process pointer from the service */
-    if (!(process = initng_process_db_get_by_pid(kpid, service)))
-    {
-	W_("Could not fetch process, even when initng_active_db_find_by_pid() saw it here!\n");
-	return;
-    }
-
-    D_("(%i), found process type: %s\n", kpid, process->pt->name);
-
-
-    /* set r_code */
-    process->r_code = r_code;
 
+	/*
+	 * Close the process output fifos to initng.
+	 */
+	if (process->out_pipe[0] > 0)
+	{
+		/*
+		 * calling initng_process_read_input, Make sure all buffers read, before closing them.
+		 */
+		initng_fd_process_read_input(service, process);
+
+		/* now close */
+		close(process->out_pipe[0]);
+		process->out_pipe[0] = 0;
+	}
+	if (process->out_pipe[1] > 0)
+	{
+		close(process->out_pipe[1]);
+		process->out_pipe[1] = 0;
+	}
 
-    /*
-     * Close the process output fifos to initng.
-     */
-    if (process->out_pipe[0] > 0)
-    {
 	/*
-	 * calling initng_process_read_input, Make sure all buffers read, before closing them.
+	 * Set process state.
 	 */
-	initng_fd_process_read_input(service, process);
+	process->pst = P_RETURNED;
 
-	/* now close */
-	close(process->out_pipe[0]);
-	process->out_pipe[0] = 0;
-    }
-    if (process->out_pipe[1] > 0)
-    {
-	close(process->out_pipe[1]);
-	process->out_pipe[1] = 0;
-    }
-
-    /*
-     * Set process state.
-     */
-    process->pst = P_RETURNED;
-
-    /* Check if a plugin wants to override handle_killed behavior */
-    if (initng_plugin_callers_handle_killed(service, process))
-    {
-	D_("Plugin did handle this kill.\n");
-	return;
-    }
-
-
-    /* launch a kill_handler if any */
-    if (process->pt && process->pt->kill_handler)
-    {
-	D_("Launching process->pt->kill_handler\n");
-	(*process->pt->kill_handler) (service, process);
-    }
-    else
-    {
-	D_("service %s pid %i p_type %s died with unknown handler, freeing process!\n", service->name, kpid, process->pt->name);
-	list_del(&process->list);
-	initng_process_db_free(process);
-    }
+	/* Check if a plugin wants to override handle_killed behavior */
+	if (initng_plugin_callers_handle_killed(service, process))
+	{
+		D_("Plugin did handle this kill.\n");
+		return;
+	}
+
+
+	/* launch a kill_handler if any */
+	if (process->pt && process->pt->kill_handler)
+	{
+		D_("Launching process->pt->kill_handler\n");
+		(*process->pt->kill_handler) (service, process);
+	}
+	else
+	{
+		D_("service %s pid %i p_type %s died with unknown handler, freeing process!\n", service->name, kpid, process->pt->name);
+		list_del(&process->list);
+		initng_process_db_free(process);
+	}
 }

Modified: initng/trunk/src/initng_list.h
==============================================================================
--- initng/trunk/src/initng_list.h	(original)
+++ initng/trunk/src/initng_list.h	Wed Apr  5 23:11:19 2006
@@ -20,7 +20,7 @@
 
 struct list_head
 {
-    struct list_head *next, *prev;
+	struct list_head *next, *prev;
 };
 
 #define LIST_HEAD_INIT(name) { &(name), &(name) }
@@ -39,12 +39,12 @@
  * the prev/next entries already!
  */
 static inline void __list_add(struct list_head *new, struct list_head *prev,
-			      struct list_head *next)
+							  struct list_head *next)
 {
-    next->prev = new;
-    new->next = next;
-    new->prev = prev;
-    prev->next = new;
+	next->prev = new;
+	new->next = next;
+	new->prev = prev;
+	prev->next = new;
 }
 
 /**
@@ -57,10 +57,10 @@
  */
 static inline void list_add(struct list_head *new, struct list_head *head)
 {
-    /* make sure its not already added */
-    if (new->next || new->prev)
-	return;
-    __list_add(new, head, head->next);
+	/* make sure its not already added */
+	if (new->next || new->prev)
+		return;
+	__list_add(new, head, head->next);
 }
 
 /**
@@ -72,12 +72,12 @@
  * This is useful for implementing queues.
  */
 static inline void list_add_tail(struct list_head *new,
-				 struct list_head *head)
+								 struct list_head *head)
 {
-    /* make sure its not already added */
-    if (new->next || new->prev)
-	return;
-    __list_add(new, head->prev, head);
+	/* make sure its not already added */
+	if (new->next || new->prev)
+		return;
+	__list_add(new, head->prev, head);
 }
 
 /*
@@ -89,8 +89,8 @@
  */
 static inline void __list_del(struct list_head *prev, struct list_head *next)
 {
-    next->prev = prev;
-    prev->next = next;
+	next->prev = prev;
+	prev->next = next;
 }
 
 /**
@@ -100,13 +100,13 @@
  */
 static inline void list_del(struct list_head *entry)
 {
-    /* only if list is added on a struct */
-    if (entry->next || entry->prev)
-    {
-	__list_del(entry->prev, entry->next);
-	entry->next = (void *) 0;
-	entry->prev = (void *) 0;
-    }
+	/* only if list is added on a struct */
+	if (entry->next || entry->prev)
+	{
+		__list_del(entry->prev, entry->next);
+		entry->next = (void *) 0;
+		entry->prev = (void *) 0;
+	}
 }
 
 /**
@@ -115,8 +115,8 @@
  */
 static inline void list_del_init(struct list_head *entry)
 {
-    __list_del(entry->prev, entry->next);
-    INIT_LIST_HEAD(entry);
+	__list_del(entry->prev, entry->next);
+	INIT_LIST_HEAD(entry);
 }
 
 /**
@@ -126,8 +126,8 @@
  */
 static inline void list_move(struct list_head *list, struct list_head *head)
 {
-    __list_del(list->prev, list->next);
-    list_add(list, head);
+	__list_del(list->prev, list->next);
+	list_add(list, head);
 }
 
 /**
@@ -136,10 +136,10 @@
  * @head: the head that will follow our entry
  */
 static inline void list_move_tail(struct list_head *list,
-				  struct list_head *head)
+								  struct list_head *head)
 {
-    __list_del(list->prev, list->next);
-    list_add_tail(list, head);
+	__list_del(list->prev, list->next);
+	list_add_tail(list, head);
 }
 
 /**
@@ -148,21 +148,21 @@
  */
 static inline int list_empty(struct list_head *head)
 {
-    return head->next == head;
+	return head->next == head;
 }
 
 static inline void __list_splice(struct list_head *list,
-				 struct list_head *head)
+								 struct list_head *head)
 {
-    struct list_head *first = list->next;
-    struct list_head *last = list->prev;
-    struct list_head *at = head->next;
+	struct list_head *first = list->next;
+	struct list_head *last = list->prev;
+	struct list_head *at = head->next;
 
-    first->prev = head;
-    head->next = first;
+	first->prev = head;
+	head->next = first;
 
-    last->next = at;
-    at->prev = last;
+	last->next = at;
+	at->prev = last;
 }
 
 /**
@@ -172,8 +172,8 @@
  */
 static inline void list_splice(struct list_head *list, struct list_head *head)
 {
-    if (!list_empty(list))
-	__list_splice(list, head);
+	if (!list_empty(list))
+		__list_splice(list, head);
 }
 
 /**
@@ -184,13 +184,13 @@
  * The list at @list is reinitialised
  */
 static inline void list_splice_init(struct list_head *list,
-				    struct list_head *head)
+									struct list_head *head)
 {
-    if (!list_empty(list))
-    {
-	__list_splice(list, head);
-	INIT_LIST_HEAD(list);
-    }
+	if (!list_empty(list))
+	{
+		__list_splice(list, head);
+		INIT_LIST_HEAD(list);
+	}
 }
 
 /**

Modified: initng/trunk/src/initng_load_module.c
==============================================================================
--- initng/trunk/src/initng_load_module.c	(original)
+++ initng/trunk/src/initng_load_module.c	Wed Apr  5 23:11:19 2006
@@ -90,18 +90,18 @@
  */
 static int initng_load_module_is_loaded(const char *module_name)
 {
-    m_h *m = NULL;
+	m_h *m = NULL;
 
-    assert(module_name != NULL);
+	assert(module_name != NULL);
 
-    while_module_db(m)
-    {
-	if (strcmp(m->module_name, module_name) == 0)
+	while_module_db(m)
 	{
-	    return TRUE;
+		if (strcmp(m->module_name, module_name) == 0)
+		{
+			return TRUE;
+		}
 	}
-    }
-    return FALSE;
+	return FALSE;
 }
 
 /* 
@@ -109,33 +109,33 @@
  */
 static int initng_load_module_needs_are_loaded(const m_h * m)
 {
-    char **needs;
-    int retval;
+	char **needs;
+	int retval;
 
-    assert(m != NULL);
+	assert(m != NULL);
 
-    /* if there are no needs, then we have met them */
-    if (m->module_needs == NULL)
-    {
-	return TRUE;
-    }
+	/* if there are no needs, then we have met them */
+	if (m->module_needs == NULL)
+	{
+		return TRUE;
+	}
 
-    /* otherwise check each one */
-    needs = m->module_needs;
-    retval = TRUE;
-    if (needs != NULL)
-    {
-	while (*needs != NULL)
-	{
-	    if (!initng_load_module_is_loaded(*needs))
-	    {
-		D_("Module \"%s\" needs \"%s\"\n", m->module_name, *needs);
-		retval = FALSE;
-	    }
-	    needs++;
+	/* otherwise check each one */
+	needs = m->module_needs;
+	retval = TRUE;
+	if (needs != NULL)
+	{
+		while (*needs != NULL)
+		{
+			if (!initng_load_module_is_loaded(*needs))
+			{
+				D_("Module \"%s\" needs \"%s\"\n", m->module_name, *needs);
+				retval = FALSE;
+			}
+			needs++;
+		}
 	}
-    }
-    return retval;
+	return retval;
 }
 
 /* 
@@ -144,78 +144,78 @@
  */
 m_h *initng_load_module_open(const char *module_path, const char *module_name)
 {
-    struct stat st;
-    char *errmsg;
-    m_h *m = NULL;
-
-    assert(module_path != NULL);
-    assert(module_name != NULL);
-
-    /* allocate, the new module info struct */
-    if (!(m = (m_h *) i_calloc(1, sizeof(m_h))))
-    {
-	F_("Unable to allocate memory, for new module description.\n");
-	return (NULL);
-    }
-
-    m->initziated = FALSE;
-
-    /* check that file exists */
-    if (stat(module_path, &st) != 0)
-    {
-	F_("Module \"%s\" not found\n", module_path);
-	free(m);
-	return (NULL);
-    }
+	struct stat st;
+	char *errmsg;
+	m_h *m = NULL;
 
-    /* open module */
-    dlerror();				    /* clear any existing error */
-    m->module_dlhandle = dlopen(module_path, RTLD_LAZY);
-    /* 
-     * this breaks ngc2 on my testbox - neuron : 
-     * g.modules[i].module = dlopen(module_name, RTLD_NOW | RTLD_GLOBAL); 
-     * */
-    if (m->module_dlhandle == NULL)
-    {
-	F_("Error opening module %s; %s\n", module_name, dlerror());
-	free(m);
-	return (NULL);
-    }
+	assert(module_path != NULL);
+	assert(module_name != NULL);
 
-    D_("Success opening module \"%s\"\n", module_name);
+	/* allocate, the new module info struct */
+	if (!(m = (m_h *) i_calloc(1, sizeof(m_h))))
+	{
+		F_("Unable to allocate memory, for new module description.\n");
+		return (NULL);
+	}
+
+	m->initziated = FALSE;
+
+	/* check that file exists */
+	if (stat(module_path, &st) != 0)
+	{
+		F_("Module \"%s\" not found\n", module_path);
+		free(m);
+		return (NULL);
+	}
 
-    /* get initialization function */
-    dlerror();				    /* clear any existing error */
-    m->module_init = dlsym(m->module_dlhandle, "module_init");
-    if (m->module_init == NULL)
-    {
-	errmsg = dlerror();
-	F_("Error reading module_init(); %s\n", errmsg);
-	initng_load_module_close_and_free(m);
-	return (NULL);
-    }
-
-    /* get unload function */
-    dlerror();				    /* clear any existing error */
-    m->module_unload = dlsym(m->module_dlhandle, "module_unload");
-    if (m->module_unload == NULL)
-    {
-	errmsg = dlerror();
-	F_("Error reading module_unload(); %s\n", errmsg);
-	initng_load_module_close_and_free(m);
-	return (NULL);
-    }
-
-    /* get dependency list (may be NULL - this is not an error) */
-    dlerror();				    /* clear any existing error */
-    m->module_needs = (char **) dlsym(m->module_dlhandle, "module_needs");
-    /* XXX: is there any way to check for "not found", since we don't 
-     * consider that an error? */
+	/* open module */
+	dlerror();								/* clear any existing error */
+	m->module_dlhandle = dlopen(module_path, RTLD_LAZY);
+	/* 
+	 * this breaks ngc2 on my testbox - neuron : 
+	 * g.modules[i].module = dlopen(module_name, RTLD_NOW | RTLD_GLOBAL); 
+	 * */
+	if (m->module_dlhandle == NULL)
+	{
+		F_("Error opening module %s; %s\n", module_name, dlerror());
+		free(m);
+		return (NULL);
+	}
 
-    /* set module name in database */
-    m->module_name = i_strdup(module_name);
+	D_("Success opening module \"%s\"\n", module_name);
 
-    return (m);
+	/* get initialization function */
+	dlerror();								/* clear any existing error */
+	m->module_init = dlsym(m->module_dlhandle, "module_init");
+	if (m->module_init == NULL)
+	{
+		errmsg = dlerror();
+		F_("Error reading module_init(); %s\n", errmsg);
+		initng_load_module_close_and_free(m);
+		return (NULL);
+	}
+
+	/* get unload function */
+	dlerror();								/* clear any existing error */
+	m->module_unload = dlsym(m->module_dlhandle, "module_unload");
+	if (m->module_unload == NULL)
+	{
+		errmsg = dlerror();
+		F_("Error reading module_unload(); %s\n", errmsg);
+		initng_load_module_close_and_free(m);
+		return (NULL);
+	}
+
+	/* get dependency list (may be NULL - this is not an error) */
+	dlerror();								/* clear any existing error */
+	m->module_needs = (char **) dlsym(m->module_dlhandle, "module_needs");
+	/* XXX: is there any way to check for "not found", since we don't 
+	 * consider that an error? */
+
+	/* set module name in database */
+	m->module_name = i_strdup(module_name);
+
+	return (m);
 }
 
 /* 
@@ -223,91 +223,92 @@
  */
 void initng_load_module_close_and_free(m_h * m)
 {
-    assert(m != NULL);
+	assert(m != NULL);
 
-    /* free module name */
-    if (m->module_name)
-    {
-	free(m->module_name);
-	m->module_name = NULL;
-    }
-
-    /* close the lib */
-    if (m->module_dlhandle)
-	dlclose(m->module_dlhandle);
+	/* free module name */
+	if (m->module_name)
+	{
+		printf("Free: %s\n", m->module_name);
+		free(m->module_name);
+		m->module_name = NULL;
+	}
 
-    /* remove from list if added */
-    list_del(&m->list);
+	/* close the lib */
+	if (m->module_dlhandle)
+		dlclose(m->module_dlhandle);
 
-    /* free struct */
-    free(m);
+	/* remove from list if added */
+	list_del(&m->list);
+
+	/* free struct */
+	free(m);
 }
 
 /* load a dynamic module */
 /* XXX: more information! */
 m_h *initng_load_module(const char *module_name)
 {
-    char *module_path;
-    m_h *new_m;
+	char *module_path;
+	m_h *new_m;
+
+	assert(module_name != NULL);
+
+
+	/* look for duplicates */
+	if (initng_load_module_is_loaded(module_name))
+	{
+		F_("Module \"%s\" already loaded, won't load it twice\n",
+		   module_name);
+		return (NULL);
+	}
+
+
+	/* build a path */
+	module_path = (char *) i_calloc(1,
+									strlen(INITNG_PLUGIN_DIR) +
+									strlen(module_name) + 9);
+	strcpy(module_path, INITNG_PLUGIN_DIR "/lib");
+	strcat(module_path, module_name);
+	strcat(module_path, ".so");
+
+	/* load information from library */
+	new_m = initng_load_module_open(module_path, module_name);
+	free(module_path);
+
+	if (!new_m)
+	{
+		F_("Unable to load module \"%s\"\n", module_name);
+		return (NULL);
+	}
+
+	/* see if we have our dependencies met */
+	if (!initng_load_module_needs_are_loaded(new_m))
+	{
+		F_("Not loading module \"%s\", missing needed module(s)\n",
+		   module_path);
+		initng_load_module_close_and_free(new_m);
+		return (NULL);
+	}
 
-    assert(module_name != NULL);
+	/* run module_init */
+	new_m->initziated = (*new_m->module_init) (API_VERSION);
 
+	D_("for module \"%s\" return: %i\n", module_path, new_m->initziated);
+
+	if (new_m->initziated < 1)
+	{
+		F_("Module %s did not load correctly (module_init() returned %i)\n",
+		   module_path, new_m->initziated);
+		/* XXX: used to be here, but why? */
+		/* sleep(1); */
+		initng_load_module_close_and_free(new_m);
+		return (NULL);
+	}
 
-    /* look for duplicates */
-    if (initng_load_module_is_loaded(module_name))
-    {
-	F_("Module \"%s\" already loaded, won't load it twice\n",
-	   module_name);
-	return (NULL);
-    }
-
-
-    /* build a path */
-    module_path = (char *) i_calloc(1,
-				    strlen(INITNG_PLUGIN_DIR) +
-				    strlen(module_name) + 9);
-    strcpy(module_path, INITNG_PLUGIN_DIR "/lib");
-    strcat(module_path, module_name);
-    strcat(module_path, ".so");
-
-    /* load information from library */
-    new_m = initng_load_module_open(module_path, module_name);
-    free(module_path);
-
-    if (!new_m)
-    {
-	F_("Unable to load module \"%s\"\n", module_name);
-	return (NULL);
-    }
-
-    /* see if we have our dependencies met */
-    if (!initng_load_module_needs_are_loaded(new_m))
-    {
-	F_("Not loading module \"%s\", missing needed module(s)\n",
-	   module_path);
-	initng_load_module_close_and_free(new_m);
-	return (NULL);
-    }
-
-    /* run module_init */
-    new_m->initziated = (*new_m->module_init) (API_VERSION);
-
-    D_("for module \"%s\" return: %i\n", module_path, new_m->initziated);
-
-    if (new_m->initziated < 1)
-    {
-	F_("Module %s did not load correctly (module_init() returned %i)\n",
-	   module_path, new_m->initziated);
-	/* XXX: used to be here, but why? */
-	/* sleep(1); */
-	initng_load_module_close_and_free(new_m);
-	return (NULL);
-    }
-
-    assert(new_m->module_name);
-    list_add(&new_m->list, &g.module_db.list);
-    /* and we're done */
-    return (new_m);
+	assert(new_m->module_name);
+	list_add(&new_m->list, &g.module_db.list);
+	/* and we're done */
+	return (new_m);
 }
 
 
@@ -319,31 +320,31 @@
  */
 static int initng_load_module_is_needed(const char *module_name)
 {
-    char **needs;
-    m_h *m = NULL;
-    int retval = FALSE;
-
-    assert(module_name != NULL);
-
-    while_module_db(m)
-    {
-	/* if not this module, have needs set, continue.. */
-	if (!(m->module_needs))
-	    continue;
-	needs = m->module_needs;
+	char **needs;
+	m_h *m = NULL;
+	int retval = FALSE;
 
-	while (*needs != NULL)
+	assert(module_name != NULL);
+
+	while_module_db(m)
 	{
-	    if (strcmp(module_name, *needs) == 0)
-	    {
-		F_("Module \"%s\" needed by \"%s\"\n", module_name,
-		   m->module_name);
-		retval = TRUE;
-	    }
-	    needs++;
+		/* if not this module, have needs set, continue.. */
+		if (!(m->module_needs))
+			continue;
+		needs = m->module_needs;
+
+		while (*needs != NULL)
+		{
+			if (strcmp(module_name, *needs) == 0)
+			{
+				F_("Module \"%s\" needed by \"%s\"\n", module_name,
+				   m->module_name);
+				retval = TRUE;
+			}
+			needs++;
+		}
 	}
-    }
-    return retval;
+	return retval;
 }
 
 /*
@@ -351,147 +352,147 @@
  */
 static void initng_unload_module(m_h * module)
 {
-    assert(module != NULL);
+	assert(module != NULL);
 
-    /* run the unload hook */
-    (*module->module_unload) ();
+	/* run the unload hook */
+	(*module->module_unload) ();
 
-    /* close and free the module entry in db */
-    initng_load_module_close_and_free(module);
+	/* close and free the module entry in db */
+	initng_load_module_close_and_free(module);
 }
 
 /* XXX: more information! */
 int initng_unload_module_named(const char *name)
 {
-    m_h *m = NULL;
+	m_h *m = NULL;
 
-    assert(name != NULL);
+	assert(name != NULL);
 
-    D_("initng_load_module_named(%s);\n", name);
+	D_("initng_load_module_named(%s);\n", name);
 
 
 
 
-    if (!initng_load_module_is_loaded(name))
-    {
-	F_("Not unloading module \"%s\", it is not loaded\n", name);
-	return FALSE;
-    }
+	if (!initng_load_module_is_loaded(name))
+	{
+		F_("Not unloading module \"%s\", it is not loaded\n", name);
+		return FALSE;
+	}
 
 
-    /* find the named module in our linked list */
+	/* find the named module in our linked list */
 
-    while_module_db(m)
-    {
-	if (strcmp(m->module_name, name) == 0)
+	while_module_db(m)
 	{
-	    m->marked_for_removal = TRUE;
-	    g.modules_to_unload = TRUE;
-	    return (TRUE);
+		if (strcmp(m->module_name, name) == 0)
+		{
+			m->marked_for_removal = TRUE;
+			g.modules_to_unload = TRUE;
+			return (TRUE);
+		}
 	}
-    }
 
-    return FALSE;
+	return FALSE;
 }
 
 int initng_load_module_load_all(void)
 {
-    DIR *d;
-    struct dirent *e;
-    char *module_path = NULL;
-    char *module_name = NULL;
-
-    m_h *current, *safe = NULL;
-
-    /* open plugin dir */
-    if (!(d = opendir(INITNG_PLUGIN_DIR)))
-    {
-	F_("Unable to open plugin directory " INITNG_PLUGIN_DIR ".\n");
-	return FALSE;
-    }
+	DIR *d;
+	struct dirent *e;
+	char *module_path = NULL;
+	char *module_name = NULL;
 
-    /* memory for full path */
-    module_path = i_calloc(strlen(INITNG_PLUGIN_DIR) + NAME_MAX + 2, 1);
+	m_h *current, *safe = NULL;
 
-    /* get every entry */
-    while ((e = readdir(d)) != NULL)
-    {
-	/* check for files, ending with .so */
-	if (fnmatch("lib*.so", e->d_name, 0) == 0)
-	{
-	    module_name = i_strndup(e->d_name + 3, strlen(e->d_name + 3) - 3);
-
-	    /* search the plugin name, for blacklisted */
-	    if (initng_common_service_blacklisted(module_name))
-	    {
-		F_("Plugin %s blacklisted.\n", module_name);
-		free(module_name);
-		module_name = NULL;
-		continue;
-	    }
-
-	    /* set full path */
-	    strcpy(module_path, INITNG_PLUGIN_DIR "/");
-	    strcat(module_path, e->d_name);
-
-	    /* open the module */
-	    current = initng_load_module_open(module_path, module_name);
-
-	    /* add this to the list of loaded modules */
-	    if (!current)
-	    {
-		free(module_name);
-		module_name = NULL;
-		continue;
-	    }
-
-	    /* add to list and continue */
-	    assert(current->module_name);
-	    list_add(&current->list, &g.module_db.list);
-	}
-	else
+	/* open plugin dir */
+	if (!(d = opendir(INITNG_PLUGIN_DIR)))
 	{
-#ifdef DEBUG
-	    if (e->d_name[0] != '.')
-	    {
-		D_("Won't load module \"%s\", doesn't match \"*.so\" pattern.\n", e->d_name);
-	    }
-#endif
+		F_("Unable to open plugin directory " INITNG_PLUGIN_DIR ".\n");
+		return FALSE;
 	}
-    }
-    closedir(d);
-
-    free(module_path);
 
-    /* load the entries on our TODO list */
-    while_module_db_safe(current, safe)
-    {
-	/* already initialized */
-	if (current->initziated == TRUE)
-	    continue;
+	/* memory for full path */
+	module_path = i_calloc(strlen(INITNG_PLUGIN_DIR) + NAME_MAX + 2, 1);
 
-	if (!initng_load_module_needs_are_loaded(current))
+	/* get every entry */
+	while ((e = readdir(d)) != NULL)
 	{
-	    initng_load_module_close_and_free(current);
-	    continue;
+		/* check for files, ending with .so */
+		if (fnmatch("lib*.so", e->d_name, 0) == 0)
+		{
+			module_name = i_strndup(e->d_name + 3, strlen(e->d_name + 3) - 3);
+
+			/* search the plugin name, for blacklisted */
+			if (initng_common_service_blacklisted(module_name))
+			{
+				F_("Plugin %s blacklisted.\n", module_name);
+				free(module_name);
+				module_name = NULL;
+				continue;
+			}
+
+			/* set full path */
+			strcpy(module_path, INITNG_PLUGIN_DIR "/");
+			strcat(module_path, e->d_name);
+
+			/* open the module */
+			current = initng_load_module_open(module_path, module_name);
+
+			/* add this to the list of loaded modules */
+			if (!current)
+			{
+				free(module_name);
+				module_name = NULL;
+				continue;
+			}
+
+			/* add to list and continue */
+			assert(current->module_name);
+			list_add(&current->list, &g.module_db.list);
+		}
+		else
+		{
+#ifdef DEBUG
+			if (e->d_name[0] != '.')
+			{
+				D_("Won't load module \"%s\", doesn't match \"*.so\" pattern.\n", e->d_name);
+			}
+#endif
+		}
 	}
+	closedir(d);
 
-	/* if we did find find a module with needs loaded, try to load it */
-	current->initziated = (*current->module_init) (API_VERSION);
-	D_("for module \"%s\" return: %i\n", current->module_name,
-	   current->initziated);
+	free(module_path);
 
-	/* check if it was initialized correctly */
-	if (current->initziated != TRUE)
+	/* load the entries on our TODO list */
+	while_module_db_safe(current, safe)
 	{
-	    F_("Module %s did not load correctly (module_init() returned %i)\n", current->module_name, current->initziated);
-	    initng_load_module_close_and_free(current);
-	}
+		/* already initialized */
+		if (current->initziated == TRUE)
+			continue;
+
+		if (!initng_load_module_needs_are_loaded(current))
+		{
+			initng_load_module_close_and_free(current);
+			continue;
+		}
+
+		/* if we did find find a module with needs loaded, try to load it */
+		current->initziated = (*current->module_init) (API_VERSION);
+		D_("for module \"%s\" return: %i\n", current->module_name,
+		   current->initziated);
+
+		/* check if it was initialized correctly */
+		if (current->initziated != TRUE)
+		{
+			F_("Module %s did not load correctly (module_init() returned %i)\n", current->module_name, current->initziated);
+			initng_load_module_close_and_free(current);
+		}
 
-    }
+	}
 
-    /*    initng_load_static_modules(); */
-    return TRUE;
+	/*    initng_load_static_modules(); */
+	return TRUE;
 }
 
 
@@ -503,17 +504,17 @@
  */
 void initng_unload_module_unload_all(void)
 {
-    m_h *m, *safe = NULL;
+	m_h *m, *safe = NULL;
 
-    while_module_db_safe(m, safe)
-    {
-	initng_unload_module(m);
-    }
+	while_module_db_safe(m, safe)
+	{
+		initng_unload_module(m);
+	}
 
-    /* reset the list, to make sure its empty */
-    INIT_LIST_HEAD(&g.module_db.list);
+	/* reset the list, to make sure its empty */
+	INIT_LIST_HEAD(&g.module_db.list);
 
-    D_("initng_load_module_close_all()\n");
+	D_("initng_load_module_close_all()\n");
 }
 
 /* 
@@ -521,26 +522,26 @@
  */
 void initng_unload_module_unload_marked(void)
 {
-    m_h *m, *safe = NULL;
+	m_h *m, *safe = NULL;
 
-    S_;
+	S_;
 
 
 
-    while_module_db_safe(m, safe)
-    {
-	if (m->marked_for_removal == TRUE)
+	while_module_db_safe(m, safe)
 	{
-	    if (initng_load_module_is_needed(m->module_name))
-	    {
-		F_("Not unloading module \"%s\", it is needed\n",
-		   m->module_name);
-		m->marked_for_removal = FALSE;
-		continue;
-	    }
-	    D_("now unloading marked module %s.\n", m->module_name);
+		if (m->marked_for_removal == TRUE)
+		{
+			if (initng_load_module_is_needed(m->module_name))
+			{
+				F_("Not unloading module \"%s\", it is needed\n",
+				   m->module_name);
+				m->marked_for_removal = FALSE;
+				continue;
+			}
+			D_("now unloading marked module %s.\n", m->module_name);
 
-	    initng_unload_module(m);
+			initng_unload_module(m);
+		}
 	}
-    }
 }

Modified: initng/trunk/src/initng_load_module.h
==============================================================================
--- initng/trunk/src/initng_load_module.h	(original)
+++ initng/trunk/src/initng_load_module.h	Wed Apr  5 23:11:19 2006
@@ -34,7 +34,7 @@
 
 /* functions for internal use only (exposed for testing) */
 m_h *initng_load_module_open(const char *module_path,
-			     const char *module_name);
+							 const char *module_name);
 void initng_load_module_close_and_free(m_h * m);
 
 #endif

Modified: initng/trunk/src/initng_main.c
==============================================================================
--- initng/trunk/src/initng_main.c	(original)
+++ initng/trunk/src/initng_main.c	Wed Apr  5 23:11:19 2006
@@ -20,14 +20,14 @@
 
 #include "initng.h"
 
-#include <time.h>			    /* time() */
-#include <fcntl.h>			    /* fcntl() */
-#include <sys/un.h>			    /* memmove() strcmp() */
-#include <sys/wait.h>			    /* waitpid() sa */
-#include <linux/kd.h>			    /* KDSIGACCEPT */
-#include <sys/ioctl.h>			    /* ioctl() */
-#include <stdlib.h>			    /* free() exit() */
-#include <sys/reboot.h>			    /* reboot() RB_DISABLE_CAD */
+#include <time.h>							/* time() */
+#include <fcntl.h>							/* fcntl() */
+#include <sys/un.h>							/* memmove() strcmp() */
+#include <sys/wait.h>						/* waitpid() sa */
+#include <linux/kd.h>						/* KDSIGACCEPT */
+#include <sys/ioctl.h>						/* ioctl() */
+#include <stdlib.h>							/* free() exit() */
+#include <sys/reboot.h>						/* reboot() RB_DISABLE_CAD */
 #include <sys/mount.h>
 #include <termios.h>
 #include <stdio.h>
@@ -58,182 +58,182 @@
  */
 int initng_main_ready_to_quit(void)
 {
-    active_db_h *current = NULL;
+	active_db_h *current = NULL;
 
-    /* If the last process has died, quit initng */
-    while_active_db(current)
-    {
-	/* Don't check with failed services */
-	if (IS_FAILED(current))
-	    continue;
-
-	/* if its down, its nothing to count on */
-	if (IS_DOWN(current))
-	    continue;
-
-	/*
-	 * if we got here,
-	 * its must be an non failing service, 
-	 * left.
-	 */
-	return (FALSE);
-    }
+	/* If the last process has died, quit initng */
+	while_active_db(current)
+	{
+		/* Don't check with failed services */
+		if (IS_FAILED(current))
+			continue;
+
+		/* if its down, its nothing to count on */
+		if (IS_DOWN(current))
+			continue;
+
+		/*
+		 * if we got here,
+		 * its must be an non failing service, 
+		 * left.
+		 */
+		return (FALSE);
+	}
 
-    return (TRUE);
+	return (TRUE);
 }
 
 /* this is called when there is no processes left */
 void initng_main_when_out(void)
 {
 
-    int failing = 0;
-    active_db_h *current = NULL;
+	int failing = 0;
+	active_db_h *current = NULL;
 
-    while_active_db(current)
-    {
-	if (IS_FAILED(current))
-	{
-	    failing++;
-	    printf("\n [%i] service \"%s\" marked \"%s\"\n", failing,
-		   current->name, current->current_state->state_name);
-	}
-    }
-    if (failing > 0)
-    {
-	printf("\n\n All %i services listed above, are marked with a failure.\n", failing);
-	printf(" Will sleep for 15 seconds before reboot/halt so you can see them.\n\n");
-	sleep(15);
-    }
+	while_active_db(current)
+	{
+		if (IS_FAILED(current))
+		{
+			failing++;
+			printf("\n [%i] service \"%s\" marked \"%s\"\n", failing,
+				   current->name, current->current_state->state_name);
+		}
+	}
+	if (failing > 0)
+	{
+		printf("\n\n All %i services listed above, are marked with a failure.\n", failing);
+		printf(" Will sleep for 15 seconds before reboot/halt so you can see them.\n\n");
+		sleep(15);
+	}
 
 
 
-    if (g.i_am_init && getpid() != 1)
-    {
-	F_("I AM NOT INIT, THIS CANT BE HAPPENING!\n");
-	sleep(3);
-	return;
-    }
+	if (g.i_am_init && getpid() != 1)
+	{
+		F_("I AM NOT INIT, THIS CANT BE HAPPENING!\n");
+		sleep(3);
+		return;
+	}
 
-    /* always good to do */
-    sync();
+	/* always good to do */
+	sync();
 
-    /* none of these calls should return, so the su_login on the end will be a fallback */
-    switch (g.when_out)
-    {
-	case THEN_QUIT:
-	    P_(" ** Now Quiting **\n");
-	    initng_main_exit(0);
-	    break;
-	case THEN_SULOGIN:
-	    P_(" ** Now SuLogin\n");
-	    /* break here leads to su_login below */
-	    break;
-	case THEN_RESTART:
-	    P_(" ** Now restarting\n");
-	    initng_main_restart();
-	    break;
-	case THEN_NEW_INIT:
-	    P_(" ** Launching new init\n");
-	    initng_main_new_init();
-	    break;
-	case THEN_REBOOT:
-	case THEN_HALT:
-	case THEN_POWEROFF:
-	    initng_hard(g.when_out);
-	    break;
-    }
+	/* none of these calls should return, so the su_login on the end will be a fallback */
+	switch (g.when_out)
+	{
+		case THEN_QUIT:
+			P_(" ** Now Quiting **\n");
+			initng_main_exit(0);
+			break;
+		case THEN_SULOGIN:
+			P_(" ** Now SuLogin\n");
+			/* break here leads to su_login below */
+			break;
+		case THEN_RESTART:
+			P_(" ** Now restarting\n");
+			initng_main_restart();
+			break;
+		case THEN_NEW_INIT:
+			P_(" ** Launching new init\n");
+			initng_main_new_init();
+			break;
+		case THEN_REBOOT:
+		case THEN_HALT:
+		case THEN_POWEROFF:
+			initng_hard(g.when_out);
+			break;
+	}
 
-    /* fallback */
-    initng_main_su_login();
+	/* fallback */
+	initng_main_su_login();
 }
 
 static void initng_hard(h_then t)
 {
-    FILE *test;
-    int pid;
+	FILE *test;
+	int pid;
 
-    /* set the sys state */
-    switch (t)
-    {
-	case THEN_REBOOT:
-	    initng_main_set_sys_state(STATE_REBOOT);
-	    break;
-	case THEN_HALT:
-	    initng_main_set_sys_state(STATE_HALT);
-	    break;
-	case THEN_POWEROFF:
-	    initng_main_set_sys_state(STATE_POWEROFF);
-	    break;
-	default:
-	    F_("initng_hard can only handle STATE_REBOOT, STATE_POWEROFF, or STATE_HALT for now.\n");
-	    return;
-    }
+	/* set the sys state */
+	switch (t)
+	{
+		case THEN_REBOOT:
+			initng_main_set_sys_state(STATE_REBOOT);
+			break;
+		case THEN_HALT:
+			initng_main_set_sys_state(STATE_HALT);
+			break;
+		case THEN_POWEROFF:
+			initng_main_set_sys_state(STATE_POWEROFF);
+			break;
+		default:
+			F_("initng_hard can only handle STATE_REBOOT, STATE_POWEROFF, or STATE_HALT for now.\n");
+			return;
+	}
 
 
-    /* sync data to disk */
-    sync();
+	/* sync data to disk */
+	sync();
 
-    /* make sure we are root */
-    if (getuid() != 0)
-	return;
+	/* make sure we are root */
+	if (getuid() != 0)
+		return;
 
-    /* unload all modules (plugins) found */
-    initng_unload_module_unload_all();
+	/* unload all modules (plugins) found */
+	initng_unload_module_unload_all();
 
-    /* Mount readonly, youst to be extra sure this is done */
-    mount("/dev/root", "/", NULL, MS_RDONLY + MS_REMOUNT, NULL);
+	/* Mount readonly, youst to be extra sure this is done */
+	mount("/dev/root", "/", NULL, MS_RDONLY + MS_REMOUNT, NULL);
 
-    if (errno == EBUSY)
-    {
-	F_("Failed to remount / ro, EBUSY\n");
-    }
-
-    /* check so that / is mounted read only, by trying to open a file */
-    if ((test = fopen("/initng_write_testfile", "w")) != NULL)
-    {
-	fclose(test);
-	unlink("/initng_write_testfile");
-	F_("/ IS NOT REMOUNTED READ-ONLY, WONT REBOOT/HALT BECAUSE THE FILE SYSTEM CAN BREAK!\n");
-	return;
-    }
+	if (errno == EBUSY)
+	{
+		F_("Failed to remount / ro, EBUSY\n");
+	}
 
-    /* Under certain unknown circumstances, calling reboot(RB_POWER_OFF) from
-       pid 1 leads to a "Kernel panic - not syncing: Attempted to kill init!".
-       Workaround is to fork a child to do it. See bug #488 for details */
-    pid = fork();
-
-    /* if succeded (pid==0) or failed (pid < 0) */
-    if (pid <= 0)
-    {
-	/* child process - shut down the machine */
-	switch (t)
+	/* check so that / is mounted read only, by trying to open a file */
+	if ((test = fopen("/initng_write_testfile", "w")) != NULL)
+	{
+		fclose(test);
+		unlink("/initng_write_testfile");
+		F_("/ IS NOT REMOUNTED READ-ONLY, WONT REBOOT/HALT BECAUSE THE FILE SYSTEM CAN BREAK!\n");
+		return;
+	}
+
+	/* Under certain unknown circumstances, calling reboot(RB_POWER_OFF) from
+	   pid 1 leads to a "Kernel panic - not syncing: Attempted to kill init!".
+	   Workaround is to fork a child to do it. See bug #488 for details */
+	pid = fork();
+
+	/* if succeded (pid==0) or failed (pid < 0) */
+	if (pid <= 0)
 	{
-	    case THEN_REBOOT:
-		reboot(RB_AUTOBOOT);
-		break;
-	    case THEN_HALT:
-		reboot(RB_HALT_SYSTEM);
-		break;
-	    case THEN_POWEROFF:
-		reboot(RB_POWER_OFF);
-		break;
-	    default:
-		/* What to do here */
-		break;
-	}
-
-	/* if in fork, quit it */
-	if (pid == 0)
-	    _exit(0);
-    }
-
-    /* parent process waits for child to exit */
-    if (pid > 0)
-	waitpid(pid, NULL, 0);
-
-    /* idle forever */
-    while (1)
-	sleep(1);
+		/* child process - shut down the machine */
+		switch (t)
+		{
+			case THEN_REBOOT:
+				reboot(RB_AUTOBOOT);
+				break;
+			case THEN_HALT:
+				reboot(RB_HALT_SYSTEM);
+				break;
+			case THEN_POWEROFF:
+				reboot(RB_POWER_OFF);
+				break;
+			default:
+				/* What to do here */
+				break;
+		}
+
+		/* if in fork, quit it */
+		if (pid == 0)
+			_exit(0);
+	}
+
+	/* parent process waits for child to exit */
+	if (pid > 0)
+		waitpid(pid, NULL, 0);
+
+	/* idle forever */
+	while (1)
+		sleep(1);
 }
 
 #define TRY_TIMES 2
@@ -242,65 +242,65 @@
  */
 void initng_main_su_login(void)
 {
-    pid_t sulogin_pid;
-    int status;
+	pid_t sulogin_pid;
+	int status;
 
 #ifdef SELINUX
-    if (is_selinux_enabled > 0)
-    {
-	security_context_t *contextlist = NULL;
-
-	if (get_ordered_context_list("root", 0, &contextlist) > 0)
+	if (is_selinux_enabled > 0)
 	{
-	    if (setexeccon(contextlist[0]) != 0)
-		fprintf(stderr, "setexeccon failed\n");
-	    freeconary(contextlist);
-	}
-    }
-#endif
-    /* sulogin nicely 2 times */
-    if (local_sulogin_count <= TRY_TIMES)
-    {
-	printf("This is a sulogin offer,\n"
-	       "you will be able to login for %i times (now %i),\n"
-	       "and on return initng will try continue where it was,\n"
-	       "if the times go out, initng will launch\n"
-	       "/sbin/initng-segfault on next su_login request.\n\n",
-	       TRY_TIMES, local_sulogin_count);
-	sulogin_pid = fork();
-
-	if (sulogin_pid == 0)
-	{
-	    const char *sulogin_argv[] = { "/sbin/sulogin", NULL };
-	    const char *sulogin_env[] = { NULL };
-
-	    /* launch sulogin */
-	    execve(sulogin_argv[0], (char **) sulogin_argv,
-		   (char **) sulogin_env);
+		security_context_t *contextlist = NULL;
 
-	    printf("Unable to execute /sbin/sulogin!\n");
-	    _exit(1);
+		if (get_ordered_context_list("root", 0, &contextlist) > 0)
+		{
+			if (setexeccon(contextlist[0]) != 0)
+				fprintf(stderr, "setexeccon failed\n");
+			freeconary(contextlist);
+		}
 	}
-
-	if (sulogin_pid > 0)
+#endif
+	/* sulogin nicely 2 times */
+	if (local_sulogin_count <= TRY_TIMES)
 	{
-	    do
-	    {
-		sulogin_pid = waitpid(sulogin_pid, &status, WUNTRACED);
-	    }
-	    while (!WIFEXITED(status) && !WIFSIGNALED(status));
-
-	    /* increase the sulogin_count */
-	    local_sulogin_count++;
-	    return;
+		printf("This is a sulogin offer,\n"
+			   "you will be able to login for %i times (now %i),\n"
+			   "and on return initng will try continue where it was,\n"
+			   "if the times go out, initng will launch\n"
+			   "/sbin/initng-segfault on next su_login request.\n\n",
+			   TRY_TIMES, local_sulogin_count);
+		sulogin_pid = fork();
+
+		if (sulogin_pid == 0)
+		{
+			const char *sulogin_argv[] = { "/sbin/sulogin", NULL };
+			const char *sulogin_env[] = { NULL };
+
+			/* launch sulogin */
+			execve(sulogin_argv[0], (char **) sulogin_argv,
+				   (char **) sulogin_env);
+
+			printf("Unable to execute /sbin/sulogin!\n");
+			_exit(1);
+		}
+
+		if (sulogin_pid > 0)
+		{
+			do
+			{
+				sulogin_pid = waitpid(sulogin_pid, &status, WUNTRACED);
+			}
+			while (!WIFEXITED(status) && !WIFSIGNALED(status));
+
+			/* increase the sulogin_count */
+			local_sulogin_count++;
+			return;
+		}
 	}
-    }
 
-    /* else run segfault script */
-    initng_main_segfault();
+	/* else run segfault script */
+	initng_main_segfault();
 
-    /* newer get here */
-    _exit(1);
+	/* newer get here */
+	_exit(1);
 }
 
 /*
@@ -308,101 +308,101 @@
  */
 void initng_main_start_extra_services(void)
 {
-    int i;
-    int a_count = 0;		/* counts orders from argv to start */
+	int i;
+	int a_count = 0;			/* counts orders from argv to start */
 
-    initng_main_set_sys_state(STATE_STARTING);
-    /* check with argv which service to start initiating */
-    for (i = 1; i < g.Argc; i++)
-    {
-	/* start all services that is +service */
-	if (g.Argv[i][0] != '+')
-	    continue;
-
-	/* if succeed to load this service */
-	if (initng_handler_start_new_service_named(g.Argv[i] + 1))
-	    a_count++;
-	else
-	    F_(" Requested service \"%s\", could not be executed!\n",
-	       g.Argv[i]);
-    }
+	initng_main_set_sys_state(STATE_STARTING);
+	/* check with argv which service to start initiating */
+	for (i = 1; i < g.Argc; i++)
+	{
+		/* start all services that is +service */
+		if (g.Argv[i][0] != '+')
+			continue;
+
+		/* if succeed to load this service */
+		if (initng_handler_start_new_service_named(g.Argv[i] + 1))
+			a_count++;
+		else
+			F_(" Requested service \"%s\", could not be executed!\n",
+			   g.Argv[i]);
+	}
 }
 
 /* This is same as execve() */
 void initng_main_new_init(void)
 {
-    int i;
+	int i;
 
-    initng_main_set_sys_state(STATE_EXECVE);
-    for (i = 3; i <= 1013; i++)
-    {
-	close(i);
-    }
-    if (!g.new_init || !g.new_init[0])
-    {
-	F_(" g.new_init is not set!\n");
-	return;
-    }
-    P_("\n\n\n          Launching new init (%s)\n\n", g.new_init[0]);
-    execve(g.new_init[0], g.new_init, environ);
+	initng_main_set_sys_state(STATE_EXECVE);
+	for (i = 3; i <= 1013; i++)
+	{
+		close(i);
+	}
+	if (!g.new_init || !g.new_init[0])
+	{
+		F_(" g.new_init is not set!\n");
+		return;
+	}
+	P_("\n\n\n          Launching new init (%s)\n\n", g.new_init[0]);
+	execve(g.new_init[0], g.new_init, environ);
 }
 
 
 void initng_main_restart(void)
 {
-    char **argv = NULL;
-    int i;
+	char **argv = NULL;
+	int i;
+
+	initng_main_set_sys_state(STATE_RESTART);
+	for (i = 3; i <= 1013; i++)
+	{
+		close(i);
+	}
+	argv = (char **) i_calloc(3, sizeof(char *));
 
-    initng_main_set_sys_state(STATE_RESTART);
-    for (i = 3; i <= 1013; i++)
-    {
-	close(i);
-    }
-    argv = (char **) i_calloc(3, sizeof(char *));
-
-    argv[0] = (char *) i_calloc(strlen(g.runlevel) + 12, sizeof(char));
-    strcpy(argv[0], "runlevel=");
-    strcat(argv[0], g.runlevel);
-    argv[1] = NULL;
-    P_("\n\n\n          R E S T A R T I N G,  (Really hot reboot)\n\n");
-    execve("/sbin/initng", argv, environ);
+	argv[0] = (char *) i_calloc(strlen(g.runlevel) + 12, sizeof(char));
+	strcpy(argv[0], "runlevel=");
+	strcat(argv[0], g.runlevel);
+	argv[1] = NULL;
+	P_("\n\n\n          R E S T A R T I N G,  (Really hot reboot)\n\n");
+	execve("/sbin/initng", argv, environ);
 }
 
 /* this function sets g.sys_state, and call plug-ins that listen on its change */
 void initng_main_set_sys_state(h_sys_state state)
 {
-    /* don't set a state that is */
-    if (state == g.sys_state)
-	return;
+	/* don't set a state that is */
+	if (state == g.sys_state)
+		return;
 
-    D_("set_sys_state(): %% Setting state to: %i %% \n", state);
-    g.sys_state = state;
+	D_("set_sys_state(): %% Setting state to: %i %% \n", state);
+	g.sys_state = state;
 
-    /*
-     * execute all functions in modules that want to
-     * be executed when system state change occurs.
-     */
+	/*
+	 * execute all functions in modules that want to
+	 * be executed when system state change occurs.
+	 */
 
-    initng_plugin_callers_load_module_system_changed(state);
-    return;
+	initng_plugin_callers_load_module_system_changed(state);
+	return;
 }
 
 
 void initng_main_exit(int i)
 {
-    D_("exit_initng();\n");
+	D_("exit_initng();\n");
 
-    /* First set the system state to exit */
-    initng_main_set_sys_state(STATE_EXIT);
+	/* First set the system state to exit */
+	initng_main_set_sys_state(STATE_EXIT);
 
-    /* Free all global variables */
-    initng_global_free();
+	/* Free all global variables */
+	initng_global_free();
 
-    /* Then, unload all modules */
-    initng_unload_module_unload_all();
+	/* Then, unload all modules */
+	initng_unload_module_unload_all();
 
-    /* And exit with return code */
-    exit(i);
+	/* And exit with return code */
+	exit(i);
 }
 
 /*
@@ -413,105 +413,105 @@
  */
 void initng_main_segfault(void)
 {
-    int i = 0;
+	int i = 0;
 
-    /* open a direct socket to /dev/console */
-    int emergency_output = -1;
+	/* open a direct socket to /dev/console */
+	int emergency_output = -1;
 
 
-    /* if this is not init */
-    if (!g.i_am_init)
-    {
-	/* just quit */
-	_exit(99);
-    }
+	/* if this is not init */
+	if (!g.i_am_init)
+	{
+		/* just quit */
+		_exit(99);
+	}
 
 #ifdef DEBUG
 #define MESSAGE "Initng segfaulted, will wait in 20 seconds for you to start a gdb, before execve(/sbin/initng-segfault);\n"
 
-    /* Try to launch a getty, that we may if lucky login to tty9 and run gdb there */
-    if (fork() == 0)
-    {
-	const char *getty_argv[] = { "/sbin/getty", "38400", "tty9", NULL };
-	const char *getty_env[] = { NULL };
-
-	/* execve getty in the fork */
-	execve((char *) getty_argv[0], (char **) getty_argv,
-	       (char **) getty_env);
-	_exit(1);
-    }
+	/* Try to launch a getty, that we may if lucky login to tty9 and run gdb there */
+	if (fork() == 0)
+	{
+		const char *getty_argv[] = { "/sbin/getty", "38400", "tty9", NULL };
+		const char *getty_env[] = { NULL };
 
-    /* if we compiled debug mode, we get the user 20 seconds to fire up gdb, and attach pid 1 */
-    while (i < 5)
-    {
-	emergency_output = open("/dev/console", O_WRONLY);
-	if (emergency_output > 0)
+		/* execve getty in the fork */
+		execve((char *) getty_argv[0], (char **) getty_argv,
+			   (char **) getty_env);
+		_exit(1);
+	}
+
+	/* if we compiled debug mode, we get the user 20 seconds to fire up gdb, and attach pid 1 */
+	while (i < 5)
 	{
-	    write(emergency_output, MESSAGE, sizeof(char) * strlen(MESSAGE));
-	    close(emergency_output);
+		emergency_output = open("/dev/console", O_WRONLY);
+		if (emergency_output > 0)
+		{
+			write(emergency_output, MESSAGE, sizeof(char) * strlen(MESSAGE));
+			close(emergency_output);
+		}
+		sleep(4);							/*  5 times 4 is 20 seconds */
+		i++;
 	}
-	sleep(4);			    /*  5 times 4 is 20 seconds */
-	i++;
-    }
 #endif
 
 #define LMESSAGE "Launching /sbin/initng-segfault"
-    emergency_output = open("/dev/console", O_WRONLY);
-    if (emergency_output > 0)
-    {
-	write(emergency_output, LMESSAGE, sizeof(char) * strlen(LMESSAGE));
-	close(emergency_output);
-    }
-
-    /* launch initng-segfault */
-    {
-	const char *segfault_argv[] = { "/sbin/initng-segfault", NULL };
-	const char *segfault_argv_initng[] = { "/sbin/initng", "--hot_reload", NULL };
-	const char *segfault_env[] = { NULL };
-
-	/* first try /sbin/initng-segfault */
-	if (execve
-	    ((char *) segfault_argv[0], (char **) segfault_argv,
-	     (char **) segfault_env) == -1)
-	{
-	    /* then try /sbin/initng --hot_reload */
-	    if (execve
-		((char *) segfault_argv_initng[0], (char **) segfault_argv,
-		 (char **) segfault_env) == -1)
-
-	    {
-		/* else tell the user, it dont succeded to start a replacement */
-		fprintf(stderr,
-			"/sbin/initng-segfault did not exist, will die!\n");
-	    }
-	}
-
-    }
-
-    /* Looop forever ever, becouse init cant die */
-    while (1)
-    {
-	sleep(10);
-	fprintf(stderr, "INITNG_SEGFAULT\n");
-    }
+	emergency_output = open("/dev/console", O_WRONLY);
+	if (emergency_output > 0)
+	{
+		write(emergency_output, LMESSAGE, sizeof(char) * strlen(LMESSAGE));
+		close(emergency_output);
+	}
+
+	/* launch initng-segfault */
+	{
+		const char *segfault_argv[] = { "/sbin/initng-segfault", NULL };
+		const char *segfault_argv_initng[] = { "/sbin/initng", "--hot_reload", NULL };
+		const char *segfault_env[] = { NULL };
+
+		/* first try /sbin/initng-segfault */
+		if (execve
+			((char *) segfault_argv[0], (char **) segfault_argv,
+			 (char **) segfault_env) == -1)
+		{
+			/* then try /sbin/initng --hot_reload */
+			if (execve
+				((char *) segfault_argv_initng[0], (char **) segfault_argv,
+				 (char **) segfault_env) == -1)
+
+			{
+				/* else tell the user, it dont succeded to start a replacement */
+				fprintf(stderr,
+						"/sbin/initng-segfault did not exist, will die!\n");
+			}
+		}
+
+	}
+
+	/* Looop forever ever, becouse init cant die */
+	while (1)
+	{
+		sleep(10);
+		fprintf(stderr, "INITNG_SEGFAULT\n");
+	}
 }
 
 void initng_main_set_runlevel(const char *runlevel)
 {
-    /* first free the old_runlevel */
-    if (g.old_runlevel)
-    {
-	free(g.old_runlevel);
-	g.old_runlevel = NULL;
-    }
-
-    /* then move the last new, to the old */
-    if (g.runlevel)
-    {
-	g.old_runlevel = g.runlevel;
-	g.runlevel = NULL;
-    }
+	/* first free the old_runlevel */
+	if (g.old_runlevel)
+	{
+		free(g.old_runlevel);
+		g.old_runlevel = NULL;
+	}
+
+	/* then move the last new, to the old */
+	if (g.runlevel)
+	{
+		g.old_runlevel = g.runlevel;
+		g.runlevel = NULL;
+	}
 
-    /* and set the new */
-    g.runlevel = i_strdup(runlevel);
+	/* and set the new */
+	g.runlevel = i_strdup(runlevel);
 }

Modified: initng/trunk/src/initng_module.h
==============================================================================
--- initng/trunk/src/initng_module.h	(original)
+++ initng/trunk/src/initng_module.h	Wed Apr  5 23:11:19 2006
@@ -25,15 +25,15 @@
 
 typedef struct module_struct
 {
-    char *module_name;
-    void *module_dlhandle;
-    int initziated;
-    int marked_for_removal;
-    int (*module_init) (int api_version);
-    void (*module_unload) (void);
-    char **module_needs;
+	char *module_name;
+	void *module_dlhandle;
+	int initziated;
+	int marked_for_removal;
+	int (*module_init) (int api_version);
+	void (*module_unload) (void);
+	char **module_needs;
 
-    struct list_head list;
+	struct list_head list;
 } m_h;
 
 #define while_module_db(current) list_for_each_entry_prev(current, &g.module_db.list, list)

Modified: initng/trunk/src/initng_msg.h
==============================================================================
--- initng/trunk/src/initng_msg.h	(original)
+++ initng/trunk/src/initng_msg.h	Wed Apr  5 23:11:19 2006
@@ -23,9 +23,9 @@
 
 typedef enum e_errmsg_type
 {
-    MSG_FAIL = 0,
-    MSG_WARN = 1,
-    MSG = 2
+	MSG_FAIL = 0,
+	MSG_WARN = 1,
+	MSG = 2
 } e_mt;
 
 #endif

Modified: initng/trunk/src/initng_open_read_close.c
==============================================================================
--- initng/trunk/src/initng_open_read_close.c	(original)
+++ initng/trunk/src/initng_open_read_close.c	Wed Apr  5 23:11:19 2006
@@ -39,93 +39,93 @@
 
 int open_read_close(const char *filename, char **buffer)
 {
-    int conf_file;		/* File descriptor for config file */
-    struct stat stat_buf;
-    int res;			/* Result of read */
+	int conf_file;				/* File descriptor for config file */
+	struct stat stat_buf;
+	int res;					/* Result of read */
 
-    /* Mark *buffer and conf_file as not set, for cleanup if bailing out... */
+	/* Mark *buffer and conf_file as not set, for cleanup if bailing out... */
 
-    *buffer = NULL;
-    conf_file = -1;
+	*buffer = NULL;
+	conf_file = -1;
 
-    /* */
+	/* */
 
-    conf_file = open(filename, O_RDONLY);   /* Open config file. */
+	conf_file = open(filename, O_RDONLY);	/* Open config file. */
 
-    if (conf_file == -1)
-    {
-	D_("open_read_close(%s) error %d opening file; %s\n",
-	   filename, errno, strerror(errno));
+	if (conf_file == -1)
+	{
+		D_("open_read_close(%s) error %d opening file; %s\n",
+		   filename, errno, strerror(errno));
 
-	bailout(&conf_file, buffer);
-	return (FALSE);
-    }
+		bailout(&conf_file, buffer);
+		return (FALSE);
+	}
 
-    if (fstat(conf_file, &stat_buf) == -1)
-    {
-	D_("open_read_close(%s) error %s getting file size; %s\n",
-	   filename, errno, strerror(errno));
+	if (fstat(conf_file, &stat_buf) == -1)
+	{
+		D_("open_read_close(%s) error %s getting file size; %s\n",
+		   filename, errno, strerror(errno));
 
-	bailout(&conf_file, buffer);
-	return (FALSE);
-    }
+		bailout(&conf_file, buffer);
+		return (FALSE);
+	}
 
-    /* Allocate a file buffer */
+	/* Allocate a file buffer */
 
-    *buffer = (char *) i_calloc((stat_buf.st_size + 1), sizeof(char));
+	*buffer = (char *) i_calloc((stat_buf.st_size + 1), sizeof(char));
 
-    /* Read whole file */
+	/* Read whole file */
 
-    res = read(conf_file, *buffer, stat_buf.st_size);
+	res = read(conf_file, *buffer, stat_buf.st_size);
 
-    if (res == -1)
-    {
-	F_("open_read_close(%s): Error %d reading file; %s\n",
-	   filename, errno, strerror(errno));
+	if (res == -1)
+	{
+		F_("open_read_close(%s): Error %d reading file; %s\n",
+		   filename, errno, strerror(errno));
 
-	bailout(&conf_file, buffer);
-	return (FALSE);
-    }
+		bailout(&conf_file, buffer);
+		return (FALSE);
+	}
 
-    if (res != stat_buf.st_size)
-    {
-	F_("open_read_close(%s): read %d instead of %d bytes\n",
-	   filename, (int) res, (int) stat_buf.st_size);
+	if (res != stat_buf.st_size)
+	{
+		F_("open_read_close(%s): read %d instead of %d bytes\n",
+		   filename, (int) res, (int) stat_buf.st_size);
 
-	bailout(&conf_file, buffer);
-	return (FALSE);
-    }
+		bailout(&conf_file, buffer);
+		return (FALSE);
+	}
 
-    /* Normally we wouldn't care about this, but as this is init(ng)? */
+	/* Normally we wouldn't care about this, but as this is init(ng)? */
 
-    if (close(conf_file) < 0)
-    {
-	F_("open_read_close(%s): Error %d closing file; %s\n",
-	   filename, errno, strerror(errno));
+	if (close(conf_file) < 0)
+	{
+		F_("open_read_close(%s): Error %d closing file; %s\n",
+		   filename, errno, strerror(errno));
 
-	bailout(&conf_file, buffer);
-	return (FALSE);
-    }
+		bailout(&conf_file, buffer);
+		return (FALSE);
+	}
 
-    (*buffer)[stat_buf.st_size] = '\0';	    /* Null terminate *buffer */
+	(*buffer)[stat_buf.st_size] = '\0';		/* Null terminate *buffer */
 
-    return (TRUE);
+	return (TRUE);
 }
 
 /* Avoid using go to sending a pointer to conf_file */
 static void bailout(int *p_conf_file, char **buffer)
 {
-    /* if conf_file != -1 it is open */
+	/* if conf_file != -1 it is open */
 
-    if (*p_conf_file != -1)
-	(void) close(*p_conf_file);	    /* Ignore result this time */
+	if (*p_conf_file != -1)
+		(void) close(*p_conf_file);			/* Ignore result this time */
 
-    *p_conf_file = -1;
+	*p_conf_file = -1;
 
-    /* *buffer != NULL => we have called calloc, so free it */
+	/* *buffer != NULL => we have called calloc, so free it */
 
-    if (*buffer)
-	free(*buffer);
+	if (*buffer)
+		free(*buffer);
 
-    *buffer = NULL;
+	*buffer = NULL;
 }

Modified: initng/trunk/src/initng_plugin.h
==============================================================================
--- initng/trunk/src/initng_plugin.h	(original)
+++ initng/trunk/src/initng_plugin.h	Wed Apr  5 23:11:19 2006
@@ -26,46 +26,46 @@
 /* flags for f_module_h.what - correspond to the arguments of select() */
 typedef enum
 {
-    FDW_READ = 1,		/* Want notification when dat