[Initng-svn] r3692 - in initng/trunk: devtool plugins/cpout plugins/daemon plugins/find plugins/fstat plugins/ngc4 src

svn at initng.thinktux.net svn at initng.thinktux.net
Wed Apr 5 22:47:01 CEST 2006


Author: jimmy
Date: Wed Apr  5 22:46:59 2006
New Revision: 3692

Modified:
   initng/trunk/devtool/indent.sh
   initng/trunk/devtool/indent_all.sh
   initng/trunk/plugins/cpout/initng_colorprint_out.c
   initng/trunk/plugins/daemon/initng_daemon.c
   initng/trunk/plugins/find/initng_find.c
   initng/trunk/plugins/fstat/initng_fstat.c
   initng/trunk/plugins/ngc4/libngcclient.c
   initng/trunk/plugins/ngc4/ngc4.c
   initng/trunk/src/initng_active_db.c
   initng/trunk/src/initng_main.c
   initng/trunk/src/initng_struct_data.c
   initng/trunk/src/initng_struct_data.h
   initng/trunk/src/main.c
Log:
Add -ut indent options.


Modified: initng/trunk/devtool/indent.sh
==============================================================================
--- initng/trunk/devtool/indent.sh	(original)
+++ initng/trunk/devtool/indent.sh	Wed Apr  5 22:46:59 2006
@@ -1,2 +1,2 @@
 #/bin/bash
-exec indent -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -nut -fc1 -c45 -nsob $*
+exec indent -ut -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -nut -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 22:46:59 2006
@@ -8,14 +8,14 @@
 for file in `find . -name "*.c" -printf "%h/%f "`
 do
     echo "Indenting file: $file"
-    indent -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -nut -fc1 -c45 -nsob $file
+    indent -ut -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -nut -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 -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -nut -fc1 -c45 -nsob $file
+    indent -ut -ci100 -cli0 -sob -bad -bap -bbb -bl -bli0 -nce -cli4 -cbi4 -ss -npcs -nprs -npsl -i4 -lp -nut -fc1 -c45 -nsob $file
 done
 
 echo "Clean up."

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 22:46:59 2006
@@ -69,17 +69,20 @@
     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);
-    }	
+        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);
-	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);
     }
 }
 
@@ -95,21 +98,21 @@
     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);
+        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);
-	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);
     }
 }
 
@@ -141,7 +144,7 @@
 
     if (IS_UP(service))
     {
-	int t;
+        int t;
         process_h *process = initng_process_db_get_by_name("daemon", service);
 
         if (!process)
@@ -150,15 +153,15 @@
             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);
-	    
+        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);
+
         return (TRUE);
     }
 

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 22:46:59 2006
@@ -625,11 +625,13 @@
     switch (initng_execute_launch(daemon, &T_DAEMON))
     {
         case FALSE:
-            F_("Did not find a service->\"daemon\" entry to run!\n", daemon->name);
+            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);
+            F_("Service %s, could not launch service->\"daemon\"\n",
+               daemon->name);
             initng_common_mark_service(daemon, &DAEMON_FAIL_STARTING);
             return;
         default:

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 22:46:59 2006
@@ -30,7 +30,7 @@
 #include <sys/types.h>
 #include <errno.h>
 #include <dirent.h>
-                                                                                                                                                                                                                                                                                                                                                                             /*#include <dirent.h> *//* opendir() closedir() */
+                                                                                                                                                                                                                                                                                                                                                                                                     /*#include <dirent.h> *//* opendir() closedir() */
 
 #include <initng_global.h>
 #include <initng_string_tools.h>

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 22:46:59 2006
@@ -84,10 +84,10 @@
     {
         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);
-	}
+        {
+            initng_common_mark_service(service, &REQUIRE_FILE_FAILED);
+            return (FALSE);
+        }
     }
 
     return (TRUE);
@@ -124,11 +124,11 @@
     {
         if (stat(file, &file_stat) != 0)
         {
-	    initng_common_mark_service(service, &REQUIRE_FILE_AFTER_FAILED);
-	    return(FALSE);
-	}
+            initng_common_mark_service(service, &REQUIRE_FILE_AFTER_FAILED);
+            return (FALSE);
+        }
     }
-    	
+
     return (TRUE);
 }
 

Modified: initng/trunk/plugins/ngc4/libngcclient.c
==============================================================================
--- initng/trunk/plugins/ngc4/libngcclient.c	(original)
+++ initng/trunk/plugins/ngc4/libngcclient.c	Wed Apr  5 22:46:59 2006
@@ -571,7 +571,8 @@
     {
         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);
+                "service                             : " C_FG_NEON_GREEN
+                "status\n" C_OFF);
     }
     else
     {
@@ -591,8 +592,8 @@
         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,
+                    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

Modified: initng/trunk/plugins/ngc4/ngc4.c
==============================================================================
--- initng/trunk/plugins/ngc4/ngc4.c	(original)
+++ initng/trunk/plugins/ngc4/ngc4.c	Wed Apr  5 22:46:59 2006
@@ -225,10 +225,11 @@
     {
         /* 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);
+                  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;
     }
 

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 22:46:59 2006
@@ -108,28 +108,29 @@
 int reload_service_cache(data_head * head)
 {
     active_db_h *service = NULL;
-    /*printf("reload_service_cache();\n");*/
-    if(head->res)
-	return(TRUE);
-    
+
+    /*printf("reload_service_cache();\n"); */
+    if (head->res)
+        return (TRUE);
+
     /* Get the service pointer */
-    service=list_entry(head, active_db_h, data);
-    
+    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;
-	
+    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)
+    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);
+        /* 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);
+    return (FALSE);
 }
 
 /*
@@ -396,12 +397,12 @@
         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;
+
+            /* 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;
         }
     }
 }

Modified: initng/trunk/src/initng_main.c
==============================================================================
--- initng/trunk/src/initng_main.c	(original)
+++ initng/trunk/src/initng_main.c	Wed Apr  5 22:46:59 2006
@@ -414,10 +414,11 @@
 void initng_main_segfault(void)
 {
     int i = 0;
+
     /* open a direct socket to /dev/console */
     int emergency_output = -1;
-    
-    
+
+
     /* if this is not init */
     if (!g.i_am_init)
     {
@@ -429,67 +430,69 @@
 #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)
+    if (fork() == 0)
     {
-	const char *getty_argv[] = { "/sbin/getty", "38400", "tty9", NULL };
+        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);
+
+        /* 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)
+    while (i < 5)
     {
-	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++;
+        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++;
     }
 #endif
 
 #define LMESSAGE "Launching /sbin/initng-segfault"
     emergency_output = open("/dev/console", O_WRONLY);
-    if(emergency_output > 0)
+    if (emergency_output > 0)
     {
-	write(emergency_output, LMESSAGE, sizeof(char) * strlen(LMESSAGE));
-	close(emergency_output);
+        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_argv_initng[] = { "/sbin/initng", "--hot_reload", NULL };
         const char *segfault_env[] = { NULL };
 
-	/* first try /sbin/initng-segfault */
+        /* 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");
-	    }
+            /* 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)
+    while (1)
     {
-	sleep(10);
-	fprintf(stderr, "INITNG_SEGFAULT\n");
+        sleep(10);
+        fprintf(stderr, "INITNG_SEGFAULT\n");
     }
 }
 

Modified: initng/trunk/src/initng_struct_data.c
==============================================================================
--- initng/trunk/src/initng_struct_data.c	(original)
+++ initng/trunk/src/initng_struct_data.c	Wed Apr  5 22:46:59 2006
@@ -95,13 +95,13 @@
 #endif
 
     /* Now do the first hook if set */
-    if(head->data_request && (*head->data_request)(head)==FALSE)
-	return (NULL);	
+    if (head->data_request && (*head->data_request) (head) == FALSE)
+        return (NULL);
 
     /* Make sure the list is not empty */
-    if(!list_empty(&head->head.list))
-	/* put place on the initial */
-	place = head->head.list.prev;
+    if (!list_empty(&head->head.list))
+        /* put place on the initial */
+        place = head->head.list.prev;
 
     /* as long as we dont stand on the header */
     while (place && place != &head->head.list)
@@ -136,13 +136,13 @@
 
 
     /* This second hook might fill head->res */
-    if(head->res_request && (*head->res_request)(head)==FALSE)
-	return (NULL);	
+    if (head->res_request && (*head->res_request) (head) == FALSE)
+        return (NULL);
 
     /* if there is any resursive next to check, do that. */
     if (head->res)
     {
-	/* ok return with that */
+        /* ok return with that */
         return (d_get_next_var(type, vn, head->res, last));
     }
 

Modified: initng/trunk/src/initng_struct_data.h
==============================================================================
--- initng/trunk/src/initng_struct_data.h	(original)
+++ initng/trunk/src/initng_struct_data.h	Wed Apr  5 22:46:59 2006
@@ -62,12 +62,12 @@
 {
     s_data head;                /* This is the header */
     data_head *res;             /* When no data is found, go look in this s_data */
-    
+
     /*
      * function pointers, if set this will be called first before
      * looking for data.
      */
-    int (*data_request)  (data_head * data_head);
+    int (*data_request) (data_head * data_head);
     int (*res_request) (data_head * data_head);
 };
 

Modified: initng/trunk/src/main.c
==============================================================================
--- initng/trunk/src/main.c	(original)
+++ initng/trunk/src/main.c	Wed Apr  5 22:46:59 2006
@@ -467,7 +467,7 @@
 
     if (g.hot_reload)
     {
-	/* Mark service as up */
+        /* Mark service as up */
         retval = initng_plugin_callers_reload_active_db();
         if (retval != TRUE)
         {
@@ -479,7 +479,7 @@
             /* if the hot reload failed, we're probably in big trouble */
             initng_main_su_login();
         }
-	initng_main_set_sys_state(STATE_UP);
+        initng_main_set_sys_state(STATE_UP);
     }
 
     /* set title of initng, can be watched in ps -ax */
@@ -492,8 +492,8 @@
     /* make sure this is not a hot reload */
     if (!g.hot_reload)
     {
-	/* change system state */
-	initng_main_set_sys_state(STATE_STARTING);
+        /* change system state */
+        initng_main_set_sys_state(STATE_STARTING);
 
         /* first start all services, prompted at boot with +daemon/test */
         initng_main_start_extra_services();


More information about the Initng-svn mailing list