[Initng-svn] r4002 - in initng/trunk: plugins/iparser src

svn at initng.thinktux.net svn at initng.thinktux.net
Thu May 4 09:44:23 CEST 2006


Author: jimmy
Date: Thu May  4 09:44:21 2006
New Revision: 4002

Modified:
   initng/trunk/plugins/find/initng_find.c
   initng/trunk/plugins/iparser/initng_i_parser.c
   initng/trunk/src/initng_string_tools.c

Log:
Indent code.


Modified: initng/trunk/plugins/find/initng_find.c
==============================================================================
--- initng/trunk/plugins/find/initng_find.c	(original)
+++ initng/trunk/plugins/find/initng_find.c	Thu May  4 09:44:21 2006
@@ -107,14 +107,14 @@
 				while (s[i] && s[i] != '.')
 					i++;
 				s[i] = '\0';
-				
+
 				/*
 				 * this was a bug, becouse initng_common_parse_service calls this function, 
 				 * this coud easy be an cirular bug,
 				 * for now we check so that the new parse word is not the same as for_service
 				 * that was orginally looking for.
 				 */
-				if(strcmp(s, for_service)!=0)
+				if (strcmp(s, for_service) != 0)
 				{
 					D_("Service %s should be \"%s\"\n", s, for_service);
 					if ((tmp = initng_common_parse_service(s)))

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	Thu May  4 09:44:21 2006
@@ -140,18 +140,18 @@
 
 
 /* if path is daemon/bluetooth/serial/daemon */
-static service_cache_h *test_parse(char * path, const char *service_to_find)
+static service_cache_h *test_parse(char *path, const char *service_to_find)
 {
 	char filetoparse[200];
 	service_cache_h *got_serv = NULL;
-	const char * service_strip, * path_strip = NULL;
-	
+	const char *service_strip, *path_strip = NULL;
+
 	/* get string from last '/' char */
-	if((service_strip = strrchr(service_to_find, '/')))
+	if ((service_strip = strrchr(service_to_find, '/')))
 		service_strip++;
 	else
 		service_strip = service_to_find;
-		
+
 	/* 1, try /etc/initng/daemon/bluetooth/serial/daemon/daemon.i */
 	strcpy(filetoparse, INITNG_ROOT "/");
 	strcat(filetoparse, path);
@@ -168,7 +168,7 @@
 	strcat(filetoparse, INITNG_EXT);
 	if ((got_serv = parse_file(filetoparse, service_to_find)))
 		return (got_serv);
-	
+
 	/* 3, try /etc/initng/daemon/bluetooth/serial/daemon.i */
 	strcpy(filetoparse, INITNG_ROOT "/");
 	strcat(filetoparse, path);
@@ -176,45 +176,46 @@
 	if ((got_serv = parse_file(filetoparse, service_to_find)))
 		return (got_serv);
 
-	if((path_strip = strrchr(path, '/')))
+	if ((path_strip = strrchr(path, '/')))
 		path_strip++;
 	else
 		path_strip = path;
 
-	/* 4, A last try with path_strip if differ. */	
-	if(strcmp(path_strip, service_strip)!=0)
+	/* 4, A last try with path_strip if differ. */
+	if (strcmp(path_strip, service_strip) != 0)
 	{
-	strcpy(filetoparse, INITNG_ROOT "/");
-	strcat(filetoparse, path);
-	strcat(filetoparse, "/");
-	strcat(filetoparse, path_strip);
-	strcat(filetoparse, INITNG_EXT);
-	if ((got_serv = parse_file(filetoparse, service_to_find)))
-		return (got_serv);
+		strcpy(filetoparse, INITNG_ROOT "/");
+		strcat(filetoparse, path);
+		strcat(filetoparse, "/");
+		strcat(filetoparse, path_strip);
+		strcat(filetoparse, INITNG_EXT);
+		if ((got_serv = parse_file(filetoparse, service_to_find)))
+			return (got_serv);
 	}
-	
+
 	/* Cut path on last '/' */
 	char *p = NULL;
-	if((p=strrchr(path, '/')))
+
+	if ((p = strrchr(path, '/')))
 	{
-		p[0]='\0';
+		p[0] = '\0';
 
 		/* call own function again with a shorter path */
-		got_serv=test_parse(path, service_to_find);
-		if(got_serv)
+		got_serv = test_parse(path, service_to_find);
+		if (got_serv)
 		{
-			return(got_serv);
+			return (got_serv);
 		}
 	}
-	
-	return(NULL);
+
+	return (NULL);
 }
 
 /* Load a service from a service_to_find or process_path */
 static service_cache_h *initng_i_parser(const char *service_to_find)
 {
 	service_cache_h *got_serv = NULL;
-	char * path = NULL;
+	char *path = NULL;
 
 	assert(service_to_find);
 	D_("Parsing for %s\n", service_to_find);
@@ -244,14 +245,14 @@
 	 * and service "udevd"
 	 */
 
-	path=i_strdup(service_to_find);
-	if(!path)
-		return(NULL);
-		
-	got_serv=test_parse(path, service_to_find);
-	if(got_serv)
+	path = i_strdup(service_to_find);
+	if (!path)
+		return (NULL);
+
+	got_serv = test_parse(path, service_to_find);
+	if (got_serv)
 	{
-		return(got_serv);
+		return (got_serv);
 	}
 
 	D_("Was not able to parse: %s\n", service_to_find);

Modified: initng/trunk/src/initng_string_tools.c
==============================================================================
--- initng/trunk/src/initng_string_tools.c	(original)
+++ initng/trunk/src/initng_string_tools.c	Thu May  4 09:44:21 2006
@@ -144,10 +144,9 @@
 	chars = strlen(to_cmp);
 
 	/* skip beginning first spaces */
-	JUMP_SPACES(*string)
-																										/* this might be an "comp pare" */
-																										if
-																										((*string)[0] == '"' && to_cmp[0] != '"')
+	JUMP_SPACES(*string);
+	/* this might be an "comp pare" */
+	if ((*string)[0] == '"' && to_cmp[0] != '"')
 		(*string)++;
 
 	/* ok, strcasecmp this */
@@ -274,29 +273,31 @@
 const char *st_strip_path(const char *string)
 {
 	char *ret = NULL;
+
 	assert(string);
-	
+
 	/* get the last '/' char in string */
-	if(!(ret = strrchr(string, '/')))
-		return(string);
-	
-	/* skip to char after the last '/' */	
+	if (!(ret = strrchr(string, '/')))
+		return (string);
+
+	/* skip to char after the last '/' */
 	ret++;
-	return(ret);
+	return (ret);
 }
 
 /* function strips "test/go/th" to "test/go" */
 char *st_get_path(const char *string)
 {
-	char * last_slash;
+	char *last_slash;
+
 	assert(string);
-	
+
 	/* get the last_slash position */
-	if(!(last_slash=strrchr(string, '/')))
-		return(i_strdup(string));
-	
+	if (!(last_slash = strrchr(string, '/')))
+		return (i_strdup(string));
+
 	/* ok return a copy of that string */
-	return(i_strndup(string, (int) (last_slash - string)));
+	return (i_strndup(string, (int) (last_slash - string)));
 }
 
 /* function strips "test/go/th" to "test/go" and then to "test" */
@@ -307,13 +308,14 @@
 	assert(*string);
 
 	/* go to last '/' */
-	char * end = strrchr(*string, '/');
-	if(end)
+	char *end = strrchr(*string, '/');
+
+	if (end)
 	{
-		end[0]='\0';
-		return(TRUE);
+		end[0] = '\0';
+		return (TRUE);
 	}
-	return(FALSE);
+	return (FALSE);
 
 #ifdef ABOW_DOES_NOT_WORK
 	int i = 0;
@@ -346,7 +348,7 @@
  // net/eth0         net/et*            TRUE
  // net/eth1         net/eth?           TRUE
  // test/abc/def     test/*/*           TRUE
- // daemon/test		 daemon/*/*         FALSE
+ // daemon/test      daemon/*/*         FALSE
 
 int service_match(const char *string, const char *pattern)
 {
@@ -363,8 +365,8 @@
 	}
 
 	/* use fnmatch that shud serve us well as these matches looks like filename matching */
-	return(fnmatch(pattern, string, FNM_CASEFOLD) == 0);
-	
+	return (fnmatch(pattern, string, FNM_CASEFOLD) == 0);
+
 #ifdef ABOW_DOES_NOT_WORK
 	char *service_mask = NULL;
 


More information about the Initng-svn mailing list