[Initng-svn] r4007 - initng/trunk/src

svn at initng.thinktux.net svn at initng.thinktux.net
Thu May 4 10:38:18 CEST 2006


Author: deac
Date: Thu May  4 10:38:17 2006
New Revision: 4007

Modified:
   initng/trunk/src/initng_depend.c

Log:
need,use,require resolve variables now

Modified: initng/trunk/src/initng_depend.c
==============================================================================
--- initng/trunk/src/initng_depend.c	(original)
+++ initng/trunk/src/initng_depend.c	Thu May  4 10:38:17 2006
@@ -32,6 +32,7 @@
 #include "initng_toolbox.h"
 #include "initng_static_data_id.h"
 #include "initng_static_states.h"
+#include "initng_env_variable.h"
 
 #include "initng_depend.h"
 
@@ -154,6 +155,7 @@
 static int dep_on(active_db_h * service, active_db_h * check)
 {
 	const char *string = NULL;
+	char *str = NULL;
 	s_data *current = NULL;
 
 	assert(service);
@@ -161,20 +163,26 @@
 
 	while ((string = get_next_string(&REQUIRE, service, &current)))
 	{
+		str = fix_variables( string, service);
 		if (strcmp(string, check->name) == 0)
 			return (TRUE);
+		fix_free( str, string);
 	}
 	current = NULL;
 	while ((string = get_next_string(&NEED, service, &current)))
 	{
-		if (strcmp(string, check->name) == 0)
+		str = fix_variables( string, service);
+		if (strcmp(str, check->name) == 0)
 			return (TRUE);
+		fix_free( str, string);
 	}
 	current = NULL;
 	while ((string = get_next_string(&USE, service, &current)))
 	{
+		str = fix_variables( string, service);
 		if (strcmp(string, check->name) == 0)
 			return (TRUE);
+		fix_free( str, string);
 	}
 	return (FALSE);
 }
@@ -445,6 +453,7 @@
 	const char *tmp = NULL;
 	active_db_h *dep = NULL;
 	s_data *current = NULL;
+	char *str = NULL;
 
 	assert(service);
 	assert(service->name);
@@ -453,48 +462,51 @@
 
 	while ((tmp = get_next_string(&REQUIRE, service, &current)))
 	{
+		str = fix_variables( tmp, service);
 		/* look if it exits already */
-		if ((dep = initng_active_db_find_by_name(tmp)))
+		if ((dep = initng_active_db_find_by_name(str)))
 		{
 			/* 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);
+			D_("No need to LOAD %s, it is already loaded!\n", str);
 			continue;
 		}
 
 		/* OKAY, start the service */
 
-		if (!initng_handler_start_new_service_named(tmp))
+		if (!initng_handler_start_new_service_named(str))
 		{
 			F_("%s required dep \"%s\" could not start!\n", service->name,
-			   tmp);
+			   str);
 			initng_handler_stop_service(service);
 			return (FALSE);
 		}
+
+		fix_free( str, tmp);
 	}
 
 	current = NULL;
 	while ((tmp = get_next_string(&NEED, service, &current)))
 	{
+		str = fix_variables( tmp, service);
 		/* look if it exits already */
-		if ((dep = initng_active_db_find_by_name(tmp)))
+		if ((dep = initng_active_db_find_by_name(str)))
 		{
 			/* 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);
+			D_("No need to LOAD %s, it is already loaded!\n", str);
 			continue;
 		}
 
 		/* 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( str))
+			W_("service \"%s\" needs service \"%s\", that could not be found!\n", service->name, str);
 
+		fix_free( str, tmp);
+	}
 
 	return (TRUE);
 }


More information about the Initng-svn mailing list