[Initng-svn] r4371 - in initng/trunk: plugins/bash_parser plugins/cpout plugins/dbus_event plugins/history plugins/iparser plugins/nge src

svn at initng.thinktux.net svn at initng.thinktux.net
Tue Jun 6 04:23:39 CEST 2006


Author: jimmy
Date: Tue Jun  6 04:23:37 2006
New Revision: 4371

Modified:
   initng/trunk/plugins/bash_parser/bp.c
   initng/trunk/plugins/cpout/initng_colorprint_out.c
   initng/trunk/plugins/dbus_event/initng_dbusevent.c
   initng/trunk/plugins/history/initng_history.c
   initng/trunk/plugins/iparser/initng_i_parser.c
   initng/trunk/plugins/nge/initng_nge.c
   initng/trunk/plugins/syslog/initng_syslog.c
   initng/trunk/src/initng_fd.c
   initng/trunk/src/initng_fork.c
   initng/trunk/src/initng_plugin.h
   initng/trunk/src/initng_process_db.c
   initng/trunk/src/initng_process_db.h

Log:
Run thru an indent_all.sh


Modified: initng/trunk/plugins/bash_parser/bp.c
==============================================================================
--- initng/trunk/plugins/bash_parser/bp.c	(original)
+++ initng/trunk/plugins/bash_parser/bp.c	Tue Jun  6 04:23:37 2006
@@ -47,31 +47,31 @@
 int bp_send(bp_req * to_send);
 
 /* these are gonna be used for main() for every command */
-int bp_new_active(char * service, int argc, char **argv);
-int bp_abort(char * service, int argc, char **argv);
-int bp_done(char * service, int argc, char **argv);
-int bp_get_variable(char * service, int argc, char **argv);
-int bp_set_variable(char * service, int argc, char **argv);
+int bp_new_active(char *service, int argc, char **argv);
+int bp_abort(char *service, int argc, char **argv);
+int bp_done(char *service, int argc, char **argv);
+int bp_get_variable(char *service, int argc, char **argv);
+int bp_set_variable(char *service, int argc, char **argv);
 char *message;
 
 typedef struct
 {
 	const char *name;
-	int (*function) (char * service, int argc, char **argv);
+	int (*function) (char *service, int argc, char **argv);
 } command_entry;
 
 command_entry commands[] = {
-{"abort", &bp_abort},
-{"iabort", &bp_abort},
-{"register", &bp_new_active},
-{"iregister", &bp_new_active},
-{"done", &bp_done},
-{"idone", &bp_done},
-{"get", &bp_get_variable},
-{"iget", &bp_get_variable},
-{"set", &bp_set_variable},
-{"iset", &bp_set_variable},
-{NULL, NULL }
+	{"abort", &bp_abort},
+	{"iabort", &bp_abort},
+	{"register", &bp_new_active},
+	{"iregister", &bp_new_active},
+	{"done", &bp_done},
+	{"idone", &bp_done},
+	{"get", &bp_get_variable},
+	{"iget", &bp_get_variable},
+	{"set", &bp_set_variable},
+	{"iset", &bp_set_variable},
+	{NULL, NULL}
 };
 
 int main(int argc, char **argv)
@@ -92,42 +92,42 @@
 		argv0++;
 
 	/* allocate a new argv to use */
-	new_argv=calloc(argc+1, sizeof(char *));
+	new_argv = calloc(argc + 1, sizeof(char *));
 
 	/* fill it up */
 	new_argv[0] = argv0;
-	
+
 	/* copy all, but not options */
-	new_argc=0;
-	for(i=1; argv[i]; i++)
+	new_argc = 0;
+	for (i = 1; argv[i]; i++)
 	{
 		/* iset -s service test */
-		if(stop_checking == FALSE && argv[i][0] == '-')
+		if (stop_checking == FALSE && argv[i][0] == '-')
 		{
-			if(argv[i][1] == 's' && !argv[i][2] && argv[i+1][0])
+			if (argv[i][1] == 's' && !argv[i][2] && argv[i + 1][0])
 			{
-				service = argv[i+1];
+				service = argv[i + 1];
 				i++;
 				continue;
 			}
-			
+
 			printf("unknown variable \"%s\"\n", argv[i]);
 		}
 		/* stop searching for arguments behind the '=' char */
-		if(argv[i][0] == '=')
+		if (argv[i][0] == '=')
 			stop_checking = TRUE;
-			
+
 		/* copy the entry */
 		new_argc++;
-		new_argv[new_argc]=argv[i];
+		new_argv[new_argc] = argv[i];
 	}
-	
+
 	/* if service was not found.. */
-	if(!service)
+	if (!service)
 		service = getenv("SERVICE");
 
 	/* make sure */
-	if(!service)
+	if (!service)
 	{
 		printf("I dont know what service you want!\n");
 		exit(1);
@@ -144,21 +144,23 @@
 
 	/* LIST THE DB OF COMMANDS AND EXECUTE THE RIGHT ONE */
 	{
-		for(i=0;commands[i].name; i++)
+		for (i = 0; commands[i].name; i++)
 		{
-			if(strcasecmp(argv0, commands[i].name)==0)
-				status = (*commands[i].function) (service, new_argc, new_argv);
-			if(status != 99)
+			if (strcasecmp(argv0, commands[i].name) == 0)
+				status = (*commands[i].function) (service, new_argc,
+												  new_argv);
+			if (status != 99)
 				break;
 		}
 	}
-	
+
 	/* if still 99, print usage */
 	if (status == 99)
 	{
 		int i;
+
 		printf("Avaible commands:\n");
-		for(i=0;commands[i].name; i++)
+		for (i = 0; commands[i].name; i++)
 			printf(" ./%s\n", commands[i].name);
 		exit(status);
 	}
@@ -173,7 +175,7 @@
 	exit(status == TRUE ? 0 : 1);
 }
 
-int bp_abort(char *service, int argc, char ** argv)
+int bp_abort(char *service, int argc, char **argv)
 {
 	/* the request to send */
 	bp_req to_send;
@@ -186,7 +188,7 @@
 
 	return (bp_send(&to_send));
 }
-int bp_done(char *service, int argc, char ** argv)
+int bp_done(char *service, int argc, char **argv)
 {
 	/* the request to send */
 	bp_req to_send;
@@ -205,14 +207,14 @@
  *  iget exec test
  */
 
-int bp_get_variable(char *service, int argc, char ** argv)
+int bp_get_variable(char *service, int argc, char **argv)
 {
 	/* the request to send */
 	bp_req to_send;
-	
+
 	/* make sure its 1 or 2 args with this */
-	if(argc != 1 && argc != 2)
-		return(FALSE);
+	if (argc != 1 && argc != 2)
+		return (FALSE);
 
 	memset(&to_send, 0, sizeof(bp_req));
 
@@ -220,12 +222,14 @@
 
 	/* use service */
 	strncpy(to_send.u.get_variable.service, service, 100);
-	
-	
-	if(argc==1)
+
+
+	if (argc == 1)
 	{
 		strncpy(to_send.u.get_variable.vartype, argv[1], 100);
-	} else {
+	}
+	else
+	{
 		strncpy(to_send.u.get_variable.varname, argv[1], 100);
 		strncpy(to_send.u.get_variable.vartype, argv[2], 100);
 	}
@@ -236,7 +240,7 @@
 /*
  * Have 4 usages:
  *  With only 1 arg and no '=', sets a variable without value.
- *	1) iset forks
+ *  1) iset forks
  *  With only 2 args and no '=', sets a variable without value.
  *  2) iset start forks
  *  With minimum 3 words and 2on a '='
@@ -244,86 +248,88 @@
  *  With minimum 4 words and 3rd a '='
  *  4) iset exec test = "Coool"
  */
- 
-int bp_set_variable(char *service, int argc, char ** argv)
+
+int bp_set_variable(char *service, int argc, char **argv)
 {
 	/* the request to send */
 	bp_req to_send;
+
 	memset(&to_send, 0, sizeof(bp_req));
 	to_send.request = SET_VARIABLE;
 	int i;
 	int ret = FALSE;
-	
+
 	/* make sure have enought variables */
-	if(argc < 1)
-		return(FALSE);
+	if (argc < 1)
+		return (FALSE);
 
-	/* use service set in main() */	
+	/* use service set in main() */
 	strncpy(to_send.u.set_variable.service, service, 100);
-		
+
 	/* if not usage 3 or 4 */
-	if(argc < 3)
+	if (argc < 3)
 	{
 		/* handle valueless variable, type 1 */
-		if(argc == 1)
+		if (argc == 1)
 		{
 			strncpy(to_send.u.set_variable.vartype, argv[1], 100);
 			return (bp_send(&to_send));
 		}
-		
+
 		/* handle valueless variable, type 2 */
-		if(argc == 2)
+		if (argc == 2)
 		{
 			strncpy(to_send.u.set_variable.vartype, argv[1], 100);
 			strncpy(to_send.u.set_variable.varname, argv[2], 100);
 			return (bp_send(&to_send));
 		}
-		
+
 		/* then this is not valid */
-		return(FALSE);
+		return (FALSE);
 	}
-	
+
 	/* if its a short set ( type 3 )  without vartype */
-	if( argc >= 3 && argv[2][0] == '=')
+	if (argc >= 3 && argv[2][0] == '=')
 	{
 		strncpy(to_send.u.set_variable.vartype, argv[1], 100);
 		/* argv[2] == '=' */
-		for(i=3;argv[i];i++)
+		for (i = 3; argv[i]; i++)
 		{
 			strncpy(to_send.u.set_variable.value, argv[i], 1024);
-			ret=bp_send(&to_send);
+			ret = bp_send(&to_send);
 		}
-		return(ret);
+		return (ret);
 	}
-	
+
 	/* else type 4 */
-	if ( argc >= 4 && argv[3][0] == '=')
+	if (argc >= 4 && argv[3][0] == '=')
 	{
-	strncpy(to_send.u.set_variable.vartype, argv[1], 100);
-	strncpy(to_send.u.set_variable.varname, argv[2], 100);
-	/* argv[3] == '=' */
-	for(i=4;argv[i];i++)
-	{
-		strncpy(to_send.u.set_variable.value, argv[i], 1024);
-		ret=bp_send(&to_send);
-	}
-	return(ret);
+		strncpy(to_send.u.set_variable.vartype, argv[1], 100);
+		strncpy(to_send.u.set_variable.varname, argv[2], 100);
+		/* argv[3] == '=' */
+		for (i = 4; argv[i]; i++)
+		{
+			strncpy(to_send.u.set_variable.value, argv[i], 1024);
+			ret = bp_send(&to_send);
+		}
+		return (ret);
 	}
-	
-	return(FALSE);
+
+	return (FALSE);
 }
 
 
-int bp_new_active(char * service, int argc, char ** argv)
+int bp_new_active(char *service, int argc, char **argv)
 {
 	/* the request to send */
 	bp_req to_send;
+
 	memset(&to_send, 0, sizeof(bp_req));
 	to_send.request = NEW_ACTIVE;
 
 	/* do a check */
-	if(argc != 1)
-		return(FALSE);
+	if (argc != 1)
+		return (FALSE);
 
 	/* use servicename from main() */
 	strncpy(to_send.u.new_active.service, service, 100);

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	Tue Jun  6 04:23:37 2006
@@ -351,8 +351,8 @@
 	D_("print_system_state(): new system state: %i\n", state);
 }
 
-static int print_program_output(active_db_h * service, process_h * x, pipe_h * pi,
-								char *buffer_pos)
+static int print_program_output(active_db_h * service, process_h * x,
+								pipe_h * pi, char *buffer_pos)
 {
 	/*
 	   TODO here:

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	Tue Jun  6 04:23:37 2006
@@ -65,8 +65,8 @@
 static void check_socket(int signal);
 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, pipe_h * pi,
-								char *output);
+static int system_pipe_watchers(active_db_h * service, process_h * process,
+								pipe_h * pi, char *output);
 static int print_error(e_mt mt, const char *file, const char *func, int line,
 					   const char *format, va_list arg);
 
@@ -267,8 +267,8 @@
 	return;
 }
 
-static int system_pipe_watchers(active_db_h * service, process_h * process, pipe_h * pi,
-								char *output)
+static int system_pipe_watchers(active_db_h * service, process_h * process,
+								pipe_h * pi, char *output)
 {
 	DBusMessage *msg;
 	dbus_uint32_t serial = 0;

Modified: initng/trunk/plugins/history/initng_history.c
==============================================================================
--- initng/trunk/plugins/history/initng_history.c	(original)
+++ initng/trunk/plugins/history/initng_history.c	Tue Jun  6 04:23:37 2006
@@ -338,8 +338,8 @@
 	return (TRUE);
 }
 
-static int fetch_output(active_db_h * service, process_h * process, pipe_h * pi,
-						char *buffer_pos)
+static int fetch_output(active_db_h * service, process_h * process,
+						pipe_h * pi, char *buffer_pos)
 {
 	history_h *tmp_e = NULL;
 

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	Tue Jun  6 04:23:37 2006
@@ -421,7 +421,7 @@
 	/*         |              */
 
 	/* this fetches name, and increase *to_parse */
-	if (!(name = st_dup_next_word((const char **)to_parse)))
+	if (!(name = st_dup_next_word((const char **) to_parse)))
 	{
 		FL_(*to_parse, "Did not get a name!");
 		return (FALSE);
@@ -466,7 +466,7 @@
 		/* service test : class { */
 		/*                |       */
 
-		if (!(father_name = st_dup_next_word((const char **)to_parse)))
+		if (!(father_name = st_dup_next_word((const char **) to_parse)))
 		{
 			FL_(*to_parse, "Unable to fetch fathername.");
 			free(name);

Modified: initng/trunk/plugins/nge/initng_nge.c
==============================================================================
--- initng/trunk/plugins/nge/initng_nge.c	(original)
+++ initng/trunk/plugins/nge/initng_nge.c	Tue Jun  6 04:23:37 2006
@@ -74,8 +74,8 @@
 
 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, pipe_h * pi,
-								char *output);
+static int system_pipe_watchers(active_db_h * service, process_h * process,
+								pipe_h * pi, char *output);
 static int print_error(e_mt mt, const char *file, const char *func, int line,
 					   const char *format, va_list arg);
 
@@ -138,7 +138,8 @@
 		 */
 		initng_plugin_hook_unregister(&g.ASTATUS_CHANGE, &astatus_change);
 		initng_plugin_hook_unregister(&g.SWATCHERS, &system_state_change);
-		initng_plugin_hook_unregister(&g.BUFFER_WATCHER, &system_pipe_watchers);
+		initng_plugin_hook_unregister(&g.BUFFER_WATCHER,
+									  &system_pipe_watchers);
 		initng_plugin_hook_unregister(&g.ERR_MSG, &print_error);
 		initng_plugin_hook_unregister(&g.HANDLE_KILLED, &handle_killed);
 
@@ -509,8 +510,8 @@
 	free(buffert);
 }
 
-static int system_pipe_watchers(active_db_h * service, process_h * process, pipe_h * pi,
-								char *output)
+static int system_pipe_watchers(active_db_h * service, process_h * process,
+								pipe_h * pi, char *output)
 {
 	char *buffert = NULL;
 	int len;

Modified: initng/trunk/plugins/syslog/initng_syslog.c
==============================================================================
--- initng/trunk/plugins/syslog/initng_syslog.c	(original)
+++ initng/trunk/plugins/syslog/initng_syslog.c	Tue Jun  6 04:23:37 2006
@@ -234,8 +234,8 @@
 	return;
 }
 
-static int syslog_fetch_output(active_db_h * service, process_h * process, pipe_h * pi,
-							   char *buffer_pos)
+static int syslog_fetch_output(active_db_h * service, process_h * process,
+							   pipe_h * pi, char *buffer_pos)
 {
 	char log[201];
 	int pos = 0;

Modified: initng/trunk/src/initng_fd.c
==============================================================================
--- initng/trunk/src/initng_fd.c	(original)
+++ initng/trunk/src/initng_fd.c	Tue Jun  6 04:23:37 2006
@@ -62,7 +62,8 @@
  * be printed to screen anyway.
  */
 static void initng_fd_plugin_readpipe(active_db_h * service,
-									  process_h * process, pipe_h * pi, char *buffer_pos)
+									  process_h * process, pipe_h * pi,
+									  char *buffer_pos)
 {
 	s_call *current = NULL;
 	int delivered = FALSE;
@@ -73,7 +74,8 @@
 	while_list(current, &g.BUFFER_WATCHER)
 	{
 		D_("Calling pipewatcher plugin.\n");
-		if ((*current->c.buffer_watcher) (service, process, pi, buffer_pos) == TRUE)
+		if ((*current->c.buffer_watcher) (service, process, pi,
+										  buffer_pos) == TRUE)
 			delivered = TRUE;
 #ifdef DEBUG
 		else
@@ -90,17 +92,18 @@
 
 
 /* if there is data incomming in a pipe, tell the plugins */
-static int initng_fd_pipe(active_db_h * service, process_h * process, pipe_h * pi)
+static int initng_fd_pipe(active_db_h * service, process_h * process,
+						  pipe_h * pi)
 {
 	s_call *current = NULL;
 
 	while_list(current, &g.PIPE_WATCHER)
 	{
 		if ((*current->c.pipe_watcher) (service, process, pi) == TRUE)
-			return(TRUE);
+			return (TRUE);
 	}
 
-	return(FALSE);
+	return (FALSE);
 }
 
 
@@ -322,12 +325,12 @@
 			continue;
 		if (!currentC->c.fdh->call_module)
 			continue;
-		
+
 		/* This is a expensive test, but better safe then sorry */
-		if(!STILL_OPEN(currentC->c.fdh->fds))
+		if (!STILL_OPEN(currentC->c.fdh->fds))
 		{
 			D_("%i is not open anymore.\n", currentC->c.fdh->fds);
-			currentC->c.fdh->fds=-1;
+			currentC->c.fdh->fds = -1;
 			continue;
 		}
 
@@ -356,26 +359,28 @@
 					current_pipe->pipe[0] > 2)
 				{
 					/* expensive test to make sure the pipe is open, before adding */
-					if(!STILL_OPEN(current_pipe->pipe[0]))
+					if (!STILL_OPEN(current_pipe->pipe[0]))
 					{
-						D_("%i is not open anymore.\n", current_pipe->pipe[0]);
-						current_pipe->pipe[0]=-1;
+						D_("%i is not open anymore.\n",
+						   current_pipe->pipe[0]);
+						current_pipe->pipe[0] = -1;
 						continue;
 					}
-						
-				
+
+
 					FD_SET(current_pipe->pipe[0], &readset);
 					added++;
 				}
-				
+
 				if (current_pipe->dir == IN_AND_OUT_PIPE &&
-				    current_pipe->pipe[1] > 2)
+					current_pipe->pipe[1] > 2)
 				{
 					/* expensive test to make sure the pipe is open, before adding */
-					if(!STILL_OPEN(current_pipe->pipe[1]))
+					if (!STILL_OPEN(current_pipe->pipe[1]))
 					{
-						D_("%i is not open anymore.\n", current_pipe->pipe[1]);
-						current_pipe->pipe[1]=-1;
+						D_("%i is not open anymore.\n",
+						   current_pipe->pipe[1]);
+						current_pipe->pipe[1] = -1;
 						continue;
 					}
 
@@ -384,14 +389,14 @@
 					added++;
 				}
 
-				if (current_pipe->dir == IN_PIPE &&
-				    current_pipe->pipe[1] > 2)
+				if (current_pipe->dir == IN_PIPE && current_pipe->pipe[1] > 2)
 				{
 					/* expensive test to make sure the pipe is open, before adding */
-					if(!STILL_OPEN(current_pipe->pipe[1]))
+					if (!STILL_OPEN(current_pipe->pipe[1]))
 					{
-						D_("%i is not open anymore.\n", current_pipe->pipe[1]);
-						current_pipe->pipe[1]=-1;
+						D_("%i is not open anymore.\n",
+						   current_pipe->pipe[1]);
+						current_pipe->pipe[1] = -1;
 						continue;
 					}
 
@@ -500,8 +505,7 @@
 					&& current_pipe->pipe[0] > 2
 					&& FD_ISSET(current_pipe->pipe[0], &readset))
 				{
-					D_("BUFFERED_OUT_PIPE: Will read from %s->start_process on fd #%i\n",
-					   currentA->name, current_pipe->pipe[0]);
+					D_("BUFFERED_OUT_PIPE: Will read from %s->start_process on fd #%i\n", currentA->name, current_pipe->pipe[0]);
 
 					/* Do the actual read from pipe */
 					initng_fd_process_read_input(currentA, currentP,
@@ -512,10 +516,10 @@
 					if (retval == 0)
 						return;
 				}
-				
-				if(current_pipe->dir == OUT_PIPE &&
-				   current_pipe->pipe[0] > 2 &&
-				   FD_ISSET(current_pipe->pipe[0], &readset))
+
+				if (current_pipe->dir == OUT_PIPE &&
+					current_pipe->pipe[0] > 2 &&
+					FD_ISSET(current_pipe->pipe[0], &readset))
 				{
 					initng_fd_pipe(currentA, currentP, current_pipe);
 
@@ -524,10 +528,10 @@
 					if (retval == 0)
 						return;
 				}
-					
-				if(current_pipe->dir == IN_AND_OUT_PIPE &&
-				   current_pipe->pipe[1] > 2 &&
-				   FD_ISSET(current_pipe->pipe[1], &readset))
+
+				if (current_pipe->dir == IN_AND_OUT_PIPE &&
+					current_pipe->pipe[1] > 2 &&
+					FD_ISSET(current_pipe->pipe[1], &readset))
 				{
 					initng_fd_pipe(currentA, currentP, current_pipe);
 
@@ -537,9 +541,9 @@
 						return;
 				}
 
-				if(current_pipe->dir == IN_PIPE &&
-				   current_pipe->pipe[1] > 2 &&
-				   FD_ISSET(current_pipe->pipe[1], &writeset))
+				if (current_pipe->dir == IN_PIPE &&
+					current_pipe->pipe[1] > 2 &&
+					FD_ISSET(current_pipe->pipe[1], &writeset))
 				{
 					initng_fd_pipe(currentA, currentP, current_pipe);
 
@@ -552,8 +556,8 @@
 			}
 		}
 	}
-	
-	if(retval!=0)
+
+	if (retval != 0)
 	{
 		F_("There is a missed pipe or fd that we missed to poll!\n");
 	}

Modified: initng/trunk/src/initng_fork.c
==============================================================================
--- initng/trunk/src/initng_fork.c	(original)
+++ initng/trunk/src/initng_fork.c	Tue Jun  6 04:23:37 2006
@@ -59,19 +59,21 @@
 	/* Create all pipes */
 	while_pipes(current_pipe, process)
 	{
-		if(current_pipe->dir == IN_AND_OUT_PIPE)
+		if (current_pipe->dir == IN_AND_OUT_PIPE)
 		{
-			/*printf("calling socketpair:\n");*/
+			/*printf("calling socketpair:\n"); */
 			/* create an two directional pipe with socketpair */
-			if(socketpair(AF_UNIX, SOCK_STREAM, 0, current_pipe->pipe) < 0)
+			if (socketpair(AF_UNIX, SOCK_STREAM, 0, current_pipe->pipe) < 0)
 			{
 				F_("Fail call socketpair: \"%s\"\n", strerror(errno));
 				return (-1);
 			}
 			/* printf("parent: fd%i fork: fd%i\n", current_pipe->pipe[1], current_pipe->pipe[0]); */
-			
-		} else {
-			/* create an one directional pipe with pipe */	
+
+		}
+		else
+		{
+			/* create an one directional pipe with pipe */
 			if (pipe(current_pipe->pipe) != 0)
 			{
 				F_("Failed adding pipe ! %s\n", strerror(errno));
@@ -150,12 +152,14 @@
 					else if (current_pipe->dir == IN_AND_OUT_PIPE)
 					{
 						/* in a unidirectional socket, there is pipe[0] that is used in the child */
-						/*printf("dup2(%i, %i);\n", current_pipe->pipe[0], current_pipe->targets[i]);*/
+						/*printf("dup2(%i, %i);\n", current_pipe->pipe[0], current_pipe->targets[i]); */
 						dup2(current_pipe->pipe[0], current_pipe->targets[i]);
-					} else continue;
+					}
+					else
+						continue;
 
 					/* IMPORTANT Tell the os not to close the new target on execve */
-					/*printf("Put non close: fd%i\n", current_pipe->targets[i]);*/
+					/*printf("Put non close: fd%i\n", current_pipe->targets[i]); */
 					fcntl(current_pipe->targets[i], F_SETFD, 0);
 				}
 			}
@@ -202,11 +206,11 @@
 					close(current_pipe->pipe[0]);
 				current_pipe->pipe[0] = -1;
 			}
-			
+
 			else if (current_pipe->dir == IN_AND_OUT_PIPE)
 			{
 				/* in an unidirectional pipe, pipe[0] is fork, and pipe[1] is parrent */
-				/*printf("parrent closing: fd%i\n", current_pipe->pipe[0]);*/
+				/*printf("parrent closing: fd%i\n", current_pipe->pipe[0]); */
 				if (current_pipe->pipe[0] > 0)
 					close(current_pipe->pipe[0]);
 				current_pipe->pipe[0] = -1;

Modified: initng/trunk/src/initng_plugin.h
==============================================================================
--- initng/trunk/src/initng_plugin.h	(original)
+++ initng/trunk/src/initng_plugin.h	Tue Jun  6 04:23:37 2006
@@ -48,9 +48,10 @@
 	int (*status_change) (active_db_h * service);
 	service_cache_h *(*parser) (const char *name);
 	void (*swatcher) (h_sys_state state);
-	int (*buffer_watcher) (active_db_h * service, process_h * process, pipe_h * pi,
-						char *buffer_pos);
-	int (*pipe_watcher) (active_db_h * service, process_h * process, pipe_h * pi);
+	int (*buffer_watcher) (active_db_h * service, process_h * process,
+						   pipe_h * pi, char *buffer_pos);
+	int (*pipe_watcher) (active_db_h * service, process_h * process,
+						 pipe_h * pi);
 	int (*launch) (active_db_h * service, process_h * process,
 				   const char *exec_name);
 	int (*af_launcher) (active_db_h * service, process_h * process);

Modified: initng/trunk/src/initng_process_db.c
==============================================================================
--- initng/trunk/src/initng_process_db.c	(original)
+++ initng/trunk/src/initng_process_db.c	Tue Jun  6 04:23:37 2006
@@ -59,7 +59,7 @@
 process_h *initng_process_db_new(ptype_h * type)
 {
 	process_h *new_p = NULL;
-	pipe_h * current_pipe;
+	pipe_h *current_pipe;
 
 	/* allocate a new process entry */
 	new_p = (process_h *) i_calloc(1, sizeof(process_h));	/* Allocate memory for a new process */
@@ -88,9 +88,9 @@
 	if (!current_pipe)
 	{
 		free(new_p);
-		return(NULL);
+		return (NULL);
 	}
-	
+
 	/* we want this pipe to get fd 1 and 2 in the fork */
 	current_pipe->targets[0] = STDOUT_FILENO;
 	current_pipe->targets[1] = STDERR_FILENO;

Modified: initng/trunk/src/initng_process_db.h
==============================================================================
--- initng/trunk/src/initng_process_db.h	(original)
+++ initng/trunk/src/initng_process_db.h	Tue Jun  6 04:23:37 2006
@@ -148,7 +148,8 @@
 #define add_process(pss, sss) list_add(&(pss)->list, &(sss)->processes.list);
 
 /* used for browing pipes */
-pipe_h * pipe_new(e_pipet type, e_dir dir);
+pipe_h *pipe_new(e_pipet type, e_dir dir);
+
 #define add_pipe(PIPE, PROCESS) list_add(&(PIPE)->list, &(PROCESS)->pipes.list);
 #define while_pipes(CURRENT, PROCESS) list_for_each_entry_prev(CURRENT, &(PROCESS)->pipes.list, list)
 #define while_pipes_safe(CURRENT, PROCESS, SAFE) list_for_each_entry_prev_safe(CURRENT, SAFE, &(PROCESS)->pipes.list, list)


More information about the Initng-svn mailing list