[Initng-svn] r1663 - in initng: plugins/cpout plugins/critical plugins/dparser plugins/fstat plugins/history plugins/ngc2 plugins/provide plugins/stcmd plugins/stdout src

svn at initng.thinktux.net svn at initng.thinktux.net
Fri Sep 23 13:15:27 CEST 2005


Author: jimmy
Date: Fri Sep 23 11:31:24 2005
New Revision: 1663

Modified:
   initng/plugins/cpout/initng_colorprint_out.c
   initng/plugins/critical/initng_critical.c
   initng/plugins/dparser/initng_d_parser.c
   initng/plugins/fstat/initng_fstat.c
   initng/plugins/history/initng_history.c
   initng/plugins/ngc2/initng_ngc2.c
   initng/plugins/ngc2/ngc2.c
   initng/plugins/provide/initng_provide.c
   initng/plugins/stcmd/initng_stcmd.c
   initng/plugins/stdout/initng_stdout.c
   initng/src/initng_active_db.c
   initng/src/initng_active_db.h
   initng/src/initng_common.c
   initng/src/initng_error.c
   initng/src/initng_fd.c
   initng/src/initng_fork.c
   initng/src/initng_global.c
   initng/src/initng_global.h
   initng/src/initng_main.c
   initng/src/initng_plugin_callers.c
   initng/src/initng_service_cache.c
   initng/src/main.c
Log:
Made an indent_all.


Modified: initng/plugins/cpout/initng_colorprint_out.c
==============================================================================
--- initng/plugins/cpout/initng_colorprint_out.c	(original)
+++ initng/plugins/cpout/initng_colorprint_out.c	Fri Sep 23 11:31:24 2005
@@ -181,95 +181,104 @@
        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 skipline = FALSE;*/
+    /*int skipline = FALSE; */
     int i;
 
     S_;
     D_(" from service \"%s\"\n", service->name);
 #ifdef DEBUG
-    if(service->start_process==x)
-	D_("start_process fd# %i\n", x->stdout[0]);
-    if(service->stop_process==x)
-	D_("stop_process fd# %i\n", x->stdout[0]);
+    if (service->start_process == x)
+        D_("start_process fd# %i\n", x->stdout[0]);
+    if (service->stop_process == x)
+        D_("stop_process fd# %i\n", x->stdout[0]);
 #endif
 
-    if (datalen == 0) {
-	D_("service %s datalen == 0\n", service->name);
+    if (datalen == 0)
+    {
+        D_("service %s datalen == 0\n", service->name);
         return;
     }
     /*
-    printf("buffer_pos: %i\n", x->buffer_pos);
-    printf("datalen: %i\n", datalen);
-    printf("Buffer: \n################\n%s\n##########\n\n",x->buffer);
-    */
+       printf("buffer_pos: %i\n", x->buffer_pos);
+       printf("datalen: %i\n", datalen);
+       printf("Buffer: \n################\n%s\n##########\n\n",x->buffer);
+     */
     i = x->buffer_pos;
 
     /* a first while loop that sorts out crap */
-    while(x->buffer[i] != '\0')
+    while (x->buffer[i] != '\0')
     {
-	/*  remove lines with " [2]  Done " that bash generates. */
-	if(x->buffer[i]=='[' && x->buffer[i+2]==']') {
-	    /* jump to next line */
-	    while(x->buffer[i] && x->buffer[i]!='\n')
-		i++;
-	}
-	
-	/* if there are stupid tockens, go to next char, and run while again. */
-	if(x->buffer[i]==' ' || x->buffer[i]=='\n' || x->buffer[i]=='\t') {
-	    i++;
-	    continue;
-	}
-	
-	/* else break */
-	break;
+        /*  remove lines with " [2]  Done " that bash generates. */
+        if (x->buffer[i] == '[' && x->buffer[i + 2] == ']')
+        {
+            /* jump to next line */
+            while (x->buffer[i] && x->buffer[i] != '\n')
+                i++;
+        }
+
+        /* if there are stupid tockens, go to next char, and run while again. */
+        if (x->buffer[i] == ' ' || x->buffer[i] == '\n'
+            || x->buffer[i] == '\t')
+        {
+            i++;
+            continue;
+        }
+
+        /* else break */
+        break;
     }
 
     /* Make sure that there is anything left to write */
-    if(strlen(&x->buffer[i])<2) {
-	return;
+    if (strlen(&x->buffer[i]) < 2)
+    {
+        return;
     }
-    
+
     if (lastservice != service)
     {
         clear_lastserv();
-        printf("\n" C_CYAN " %s:" C_OFF , service->name);
-	/* print our special indented newline */
-	putchar('\n');
-	putchar(' ');
-	putchar(' ');
+        printf("\n" C_CYAN " %s:" C_OFF, service->name);
+        /* print our special indented newline */
+        putchar('\n');
+        putchar(' ');
+        putchar(' ');
         lastservice = service;
 
-    } else {
-	D_("Lastservice == service, wont print header.\n");
     }
+    else
+    {
+        D_("Lastservice == service, wont print header.\n");
+    }
+
 
-    
 
     /* while buffer lasts */
     while (x->buffer[i] != '\0')
     {
-	/*  remove lines with " [2]  Done " that bash generates. */
-	if(x->buffer[i]=='[' && x->buffer[i+2]==']') {
-	    while(x->buffer[i] && x->buffer[i]!='\n')
-		i++;
-	}
-
-	/* if this are a newline */
-	if(x->buffer[i] == '\n')
-	{
-	    /* print our special indented newline instead */
-	    putchar('\n');
-	    putchar(' ');
-	    putchar(' ');
-	    i++;
-	    
-	    /* skip spaces, on newline. */
-	    while(x->buffer[i] && (x->buffer[i]==' ' || x->buffer[i]=='\t'))
-		i++;
-	    continue;
-	}
+        /*  remove lines with " [2]  Done " that bash generates. */
+        if (x->buffer[i] == '[' && x->buffer[i + 2] == ']')
+        {
+            while (x->buffer[i] && x->buffer[i] != '\n')
+                i++;
+        }
+
+        /* if this are a newline */
+        if (x->buffer[i] == '\n')
+        {
+            /* print our special indented newline instead */
+            putchar('\n');
+            putchar(' ');
+            putchar(' ');
+            i++;
+
+            /* skip spaces, on newline. */
+            while (x->buffer[i]
+                   && (x->buffer[i] == ' ' || x->buffer[i] == '\t'))
+                i++;
+            continue;
+        }
 
-	/* ok, now put the char, and go to next. */		
+        /* ok, now put the char, and go to next. */
         putchar(x->buffer[i]);
         i++;
     }
@@ -285,7 +294,7 @@
     }
 
     printf("\n" C_BLUE "     Next Generation Init version ( %s )" C_OFF,
-		INITNG_VERSION);
+           INITNG_VERSION);
     printf("\n" C_GREEN "     http://jw.dyndns.org/initng/\n" C_OFF);
     printf("     Author: Jimmy Wennlund <jimmy.wennlund at gmail.com>\n\n");
 

Modified: initng/plugins/critical/initng_critical.c
==============================================================================
--- initng/plugins/critical/initng_critical.c	(original)
+++ initng/plugins/critical/initng_critical.c	Fri Sep 23 11:31:24 2005
@@ -43,58 +43,63 @@
     switch (service->a_status)
     {
         case FAIL_STARTING:
-	    if(active_db_is(&CRITICAL, service))
-	    {
-		F_("Service %s failed, this is critical, going su_login!!\n", service->name);
-		su_login();
-
-		/* now try to reload service from disk and run it again */
-		/* skipping virtual */
-
-		if (service->from_service)
-		{
-		    list_del(&(service->from_service->list));
-		    service_db_free(service->from_service);
-		    service->from_service = NULL;
-		    get_service(service);
-		    mark_service(service, WAITING_FOR_START_DEP);
-		}
-		
-	    } else if ((service->from_service) && (service->from_service->type == TYPE_RUNLEVEL))
-	    {
-		if (g.sys_state == STATE_STARTING)
-		{
-		    /* check if any services in this runlevel are starting */
-		    int flag=FALSE;
-            	    while ((need = active_db_get_next_string(&NEED, service, need)))
-            	    {
-    			if (!(tmp_service = active_db_find_by_name(need)))
-			    continue;
-
-			if (tmp_service->a_status == LOADING ||
-			    tmp_service->a_status == STARTING ||
-			    tmp_service->a_status == START_DEP_MET ||
-			    tmp_service->a_status == WAITING_FOR_START_DEP ||
-			    tmp_service->a_status == START_LAUNCHING ||
-    			    tmp_service->a_status == WAITING_FOR_PID_FILE)
-			{
-				flag = TRUE;
-				break;
-			}
-
-		    }
-
-		    if (flag)
-			mark_service(service, WAITING_FOR_START_DEP);
-		    else
-			mark_service(service, DONE);
-		}
-	    }
-	    break;
-	default:
-	    break;
+            if (active_db_is(&CRITICAL, service))
+            {
+                F_("Service %s failed, this is critical, going su_login!!\n",
+                   service->name);
+                su_login();
+
+                /* now try to reload service from disk and run it again */
+                /* skipping virtual */
+
+                if (service->from_service)
+                {
+                    list_del(&(service->from_service->list));
+                    service_db_free(service->from_service);
+                    service->from_service = NULL;
+                    get_service(service);
+                    mark_service(service, WAITING_FOR_START_DEP);
+                }
+
+            }
+            else if ((service->from_service)
+                     && (service->from_service->type == TYPE_RUNLEVEL))
+            {
+                if (g.sys_state == STATE_STARTING)
+                {
+                    /* check if any services in this runlevel are starting */
+                    int flag = FALSE;
+
+                    while ((need =
+                            active_db_get_next_string(&NEED, service, need)))
+                    {
+                        if (!(tmp_service = active_db_find_by_name(need)))
+                            continue;
+
+                        if (tmp_service->a_status == LOADING ||
+                            tmp_service->a_status == STARTING ||
+                            tmp_service->a_status == START_DEP_MET ||
+                            tmp_service->a_status == WAITING_FOR_START_DEP ||
+                            tmp_service->a_status == START_LAUNCHING ||
+                            tmp_service->a_status == WAITING_FOR_PID_FILE)
+                        {
+                            flag = TRUE;
+                            break;
+                        }
+
+                    }
+
+                    if (flag)
+                        mark_service(service, WAITING_FOR_START_DEP);
+                    else
+                        mark_service(service, DONE);
+                }
+            }
+            break;
+        default:
+            break;
     }
-    return(TRUE);
+    return (TRUE);
 }
 
 

Modified: initng/plugins/dparser/initng_d_parser.c
==============================================================================
--- initng/plugins/dparser/initng_d_parser.c	(original)
+++ initng/plugins/dparser/initng_d_parser.c	Fri Sep 23 11:31:24 2005
@@ -27,7 +27,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <assert.h>
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                /*#include <dirent.h> *//* opendir() closedir() */
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        /*#include <dirent.h> *//* opendir() closedir() */
 
 #include "../../src/initng_string_tools.h"
 #include "../../src/initng_service_cache.h"

Modified: initng/plugins/fstat/initng_fstat.c
==============================================================================
--- initng/plugins/fstat/initng_fstat.c	(original)
+++ initng/plugins/fstat/initng_fstat.c	Fri Sep 23 11:31:24 2005
@@ -43,26 +43,32 @@
 {
     char *file = NULL;
     struct stat file_stat;
+
     S_;
 
-    switch(service->a_status) {
-	case START_DEP_MET:
-	    /* Handle NEED */
-	    while ((file = active_db_get_next_string(&FILES_TO_EXIST, service, file)))
-	    {
-    		D_("Service %s need file %s to exist\n", service->name, file);
-		if (stat(file, &file_stat) != 0) {
-		    D_("File %s needed by %s dont exist.\n",file, service->name);
-		    /* set the alarm, make sure initng will search files, in one second */
-		    alarm(1);
-		    /* mark the service, still waiting for dep */
-		    mark_service(service, WAITING_FOR_START_DEP);
-		    return(TRUE);
-		}
-	    }
-	    break;
-	default:
-	    break;
+    switch (service->a_status)
+    {
+        case START_DEP_MET:
+            /* Handle NEED */
+            while ((file =
+                    active_db_get_next_string(&FILES_TO_EXIST, service,
+                                              file)))
+            {
+                D_("Service %s need file %s to exist\n", service->name, file);
+                if (stat(file, &file_stat) != 0)
+                {
+                    D_("File %s needed by %s dont exist.\n", file,
+                       service->name);
+                    /* set the alarm, make sure initng will search files, in one second */
+                    alarm(1);
+                    /* mark the service, still waiting for dep */
+                    mark_service(service, WAITING_FOR_START_DEP);
+                    return (TRUE);
+                }
+            }
+            break;
+        default:
+            break;
     }
     return (TRUE);
 }

Modified: initng/plugins/history/initng_history.c
==============================================================================
--- initng/plugins/history/initng_history.c	(original)
+++ initng/plugins/history/initng_history.c	Fri Sep 23 11:31:24 2005
@@ -61,7 +61,7 @@
     }
 }
 
-                                    
+
 
 static void history_db_clear_service(active_h * service)
 {
@@ -112,7 +112,7 @@
     if (!(tmp_e = (history_h *) initng_calloc(1, sizeof(history_h))))
     {
         F_("history_add_values(): Out of memory.\n");
-        return(TRUE);
+        return (TRUE);
     }
 
     /* set data in struct */
@@ -142,7 +142,7 @@
     }
 
     /* leave */
-    return(TRUE);
+    return (TRUE);
 }
 
 
@@ -153,9 +153,11 @@
 
     while_history_db_prev(current)
     {
-	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 ((arg && strlen(arg) > 1)
+            && !(((current->name) && strcmp(current->name, arg) == 0)
+                 || ((current->service && current->service->name)
+                     && strcmp(current->service->name, arg) == 0)))
+            continue;
 
         row.s = current->action;
         row.t = current->time;
@@ -178,7 +180,7 @@
         F_("This module, is compiled for \"%s\" version, and initng is compiled on \"%s\" version, wont load this module!\n", INITNG_VERSION, version);
         return (FALSE);
     }
-    
+
     INIT_LIST_HEAD(&history_db.list);
 
     initng_command_add(&HISTORYS);

Modified: initng/plugins/ngc2/initng_ngc2.c
==============================================================================
--- initng/plugins/ngc2/initng_ngc2.c	(original)
+++ initng/plugins/ngc2/initng_ngc2.c	Fri Sep 23 11:31:24 2005
@@ -546,13 +546,13 @@
     active_h *current = NULL;
     active_row row;
 
-    if(arg && strlen(arg)>1 && (current=active_db_find_by_name(arg)))
+    if (arg && strlen(arg) > 1 && (current = active_db_find_by_name(arg)))
     {
         row.s = current->a_status;
         row.t = current->time_got_status;
         strncpy(row.n, current->name, 100);
         fwrite(&row, sizeof(active_row), 1, fd);
-	return;	
+        return;
     }
 
 
@@ -595,7 +595,7 @@
     /* add the help command, that list commands to the client */
     initng_command_add(&HELP);
     initng_command_add(&SERVICES);
-    /*initng_command_add(&HISTORYS);*/
+    /*initng_command_add(&HISTORYS); */
 
 
 
@@ -619,7 +619,7 @@
     initng_del_hook(WATCHERS, &service_status);
     initng_command_del(&HELP);
     initng_command_del(&SERVICES);
-    /*initng_command_del(&HISTORYS);*/
+    /*initng_command_del(&HISTORYS); */
 
     D_("ngc2.so.0.0 unloaded!\n");
 

Modified: initng/plugins/ngc2/ngc2.c
==============================================================================
--- initng/plugins/ngc2/ngc2.c	(original)
+++ initng/plugins/ngc2/ngc2.c	Fri Sep 23 11:31:24 2005
@@ -160,7 +160,8 @@
     usleep(50000);
 
     /* if we are reloading initng, we wont have an answ from it, so dont fetch any */
-    if(header.c=='c') return(TRUE);
+    if (header.c == 'c')
+        return (TRUE);
 
     /* and of course */
     return (fetch_result());

Modified: initng/plugins/provide/initng_provide.c
==============================================================================
--- initng/plugins/provide/initng_provide.c	(original)
+++ initng/plugins/provide/initng_provide.c	Fri Sep 23 11:31:24 2005
@@ -70,7 +70,8 @@
             while ((tmp = active_db_get_next_string(&PROVIDE, service, tmp)))
             {
                 /* check if an virtual exits - then set its status */
-                if ((act = active_db_find_by_name(tmp)) && (active_db_is(&VIRTUAL, act)))
+                if ((act = active_db_find_by_name(tmp))
+                    && (active_db_is(&VIRTUAL, act)))
                 {
                     mark_service(act, service->a_status);
                 }
@@ -81,7 +82,8 @@
             while ((tmp = active_db_get_next_string(&PROVIDE, service, tmp)))
             {
                 /* check if an virtual exits - then set its status */
-                if ((act = active_db_find_by_name(tmp)) && (active_db_is(&VIRTUAL, act)))
+                if ((act = active_db_find_by_name(tmp))
+                    && (active_db_is(&VIRTUAL, act)))
                 {
                     mark_service(act, service->a_status);
                     active_db_del(act);

Modified: initng/plugins/stcmd/initng_stcmd.c
==============================================================================
--- initng/plugins/stcmd/initng_stcmd.c	(original)
+++ initng/plugins/stcmd/initng_stcmd.c	Fri Sep 23 11:31:24 2005
@@ -230,8 +230,8 @@
         return (FALSE);
 
     printf("Restart broaken!\n");
-    return(FALSE);
-    
+    return (FALSE);
+
     g.when_out = THEN_RESTART;
     g.runlevel = i_strdup(arg);
     stop_all();

Modified: initng/plugins/stdout/initng_stdout.c
==============================================================================
--- initng/plugins/stdout/initng_stdout.c	(original)
+++ initng/plugins/stdout/initng_stdout.c	Fri Sep 23 11:31:24 2005
@@ -48,6 +48,7 @@
     /* Scans through our local database, returns a new one if we cant find an old one. */
     int i;
     int foundfree = 0;
+
     S_;
 
     D_("Scan for service %s\n", service->name);
@@ -81,18 +82,20 @@
                     int forceflush)
 {
     char *filename = NULL;
+
     D_("service: \"%s\" have something to say.\n", service->name);
 
 #ifdef DEBUG
-    if(service->start_process == x)
-	D_("start process fd: #%i\n", x->stdout[0]);
-    else if(service->stop_process == x)
-	D_("stop process fd: #%i\n", x->stdout[0]);
-	
+    if (service->start_process == x)
+        D_("start process fd: #%i\n", x->stdout[0]);
+    else if (service->stop_process == x)
+        D_("stop process fd: #%i\n", x->stdout[0]);
+
 #endif
     /* Check if this service has keyword STDOUT */
-    if (!active_db_is(&STDOUT, service)) {
-	D_("STDOUT not set.\n");
+    if (!active_db_is(&STDOUT, service))
+    {
+        D_("STDOUT not set.\n");
         return;
     }
 
@@ -141,6 +144,7 @@
 int module_init(const char *version)
 {
     int i;
+
     S_;
 
     D_("module_init();\n");
@@ -166,6 +170,7 @@
 void module_unload(void)
 {
     int i;
+
     S_;
 
     D_("module_unload();\n");

Modified: initng/src/initng_active_db.c
==============================================================================
--- initng/src/initng_active_db.c	(original)
+++ initng/src/initng_active_db.c	Fri Sep 23 11:31:24 2005
@@ -66,14 +66,15 @@
     active_h *current = active_db_find_by_exact_name(service);
 
     if (current)
-	return (current);
+        return (current);
 
     /* do pattern matching only if service name does not contain wildcards */
     if (strchr(service, '*') || strchr(service, '?'))
-	return (NULL);
-    
+        return (NULL);
+
     /* create service name mask for pattern matching */
-    char *service_mask = initng_calloc(strlen(service)+3, sizeof(char));
+    char *service_mask = initng_calloc(strlen(service) + 3, sizeof(char));
+
     strcpy(service_mask, "*/");
     strcat(service_mask, service);
 
@@ -82,20 +83,21 @@
 
         /* then try to find alike name */
 
-	/* if existing service is a pattern */
-	if (strchr(current->name, '*') || strchr(current->name, '?'))
-	{
-	    if (fnmatch(current->name, service, FNM_CASEFOLD) == 0)
-
-    	    {
-        	D_("active_db_find_by_name(%s): Found\n", current->name);
-		free(service_mask);
-        	return (current);
-	    }
-        } else if (fnmatch(service_mask, current->name, FNM_CASEFOLD) == 0)
+        /* if existing service is a pattern */
+        if (strchr(current->name, '*') || strchr(current->name, '?'))
+        {
+            if (fnmatch(current->name, service, FNM_CASEFOLD) == 0)
+
+            {
+                D_("active_db_find_by_name(%s): Found\n", current->name);
+                free(service_mask);
+                return (current);
+            }
+        }
+        else if (fnmatch(service_mask, current->name, FNM_CASEFOLD) == 0)
         {
             D_("active_db_find_by_name(%s): Found\n", current->name);
-	    free(service_mask);
+            free(service_mask);
             return (current);
         }
     }
@@ -246,7 +248,7 @@
     assert(pf);
 
     D_("(%s);\n", pf->name);
-    
+
     /* look if there are plugins, that is intrested to now, this is freeing */
     initng_plugin_call(ACTIVE_FREE, pf);
 

Modified: initng/src/initng_active_db.h
==============================================================================
--- initng/src/initng_active_db.h	(original)
+++ initng/src/initng_active_db.h	Fri Sep 23 11:31:24 2005
@@ -61,7 +61,7 @@
     /* time variables */
     time_t uptime;
     time_t time_got_status;
-    
+
     /* the list */
     struct list_head list;
 };

Modified: initng/src/initng_common.c
==============================================================================
--- initng/src/initng_common.c	(original)
+++ initng/src/initng_common.c	Fri Sep 23 11:31:24 2005
@@ -338,17 +338,17 @@
     /* set the uptime counter */
     switch (service->a_status)
     {
-	case DONE:
-	case RUNNING:
-	case STARTING:
-	case STOPPING:
-	case STOPPED:
-	    service->uptime = time(0);
-	    break;
-	default:
-	    break;
+        case DONE:
+        case RUNNING:
+        case STARTING:
+        case STOPPING:
+        case STOPPED:
+            service->uptime = time(0);
+            break;
+        default:
+            break;
     }
-    /*history_add_values(service);*/
+    /*history_add_values(service); */
 
     D_("service %s is now %s.\n", service->name,
        active_db_get_status_string(service->a_status));

Modified: initng/src/initng_error.c
==============================================================================
--- initng/src/initng_error.c	(original)
+++ initng/src/initng_error.c	Fri Sep 23 11:31:24 2005
@@ -44,7 +44,9 @@
 static void verbose_print(void)
 {
     int i;
-    if(lock_error_printing == 1) return;
+
+    if (lock_error_printing == 1)
+        return;
 
     W_("This words will i look for in debug: ");
     for (i = 0; i < MAX_VERBOSES; i++)
@@ -101,38 +103,41 @@
 #ifdef DEBUG
 void print_func(const char *file, const char *func)
 {
-    int i=0;
-    if(lock_error_printing==1) return;
-    lock_error_printing=1;
+    int i = 0;
+
+    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)
+    {
+        for (i = 0; i < MAX_VERBOSES; i++)
+        {
             if (g.verbose_this[i])
             {
-                if (g.verbose_this[i][0] == '%'
-                        && (g.verbose_this[i] + 1))
+                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;
-                        }
+                        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;
-                        }
+                        strcasestr(func, g.verbose_this[i]))
+                    {
+                        i = 1;
+                        break;
+                    }
                 }
             }
-	}
+        }
     }
 
-    if (g.verbose == 1 || i==1)
+    if (g.verbose == 1 || i == 1)
     {
         if (last_file != file || last_func != func)
         {
@@ -143,7 +148,7 @@
         last_func = func;
     }
 
-    lock_error_printing=0;
+    lock_error_printing = 0;
 }
 #endif
 
@@ -158,8 +163,9 @@
     assert(file);
     assert(func);
 
-    if(lock_error_printing==1) return(0);
-    lock_error_printing=1;
+    if (lock_error_printing == 1)
+        return (0);
+    lock_error_printing = 1;
 
 
 #ifdef DEBUG
@@ -179,7 +185,7 @@
                         if (strcasestr(file, (g.verbose_this[i]) + 1) ||
                             strcasestr(func, (g.verbose_this[i]) + 1))
                         {
-			    lock_error_printing=0;
+                            lock_error_printing = 0;
                             return (TRUE);
                         }
                     }
@@ -196,7 +202,7 @@
             goto yes;
         /* else */
 
-	lock_error_printing=0;
+        lock_error_printing = 0;
         return (TRUE);
     }
   yes:
@@ -252,6 +258,6 @@
 
     va_end(arg);
 
-    lock_error_printing=0;
+    lock_error_printing = 0;
     return (done);
 }

Modified: initng/src/initng_fd.c
==============================================================================
--- initng/src/initng_fd.c	(original)
+++ initng/src/initng_fd.c	Fri Sep 23 11:31:24 2005
@@ -40,8 +40,9 @@
 void initng_close_all_fd(void)
 {
     s_call *current = NULL;
+
     S_;
-    
+
     while_call_db(current)
     {
         if (current->ptype == FDWATCHERS)
@@ -60,13 +61,14 @@
                             process_h * process, int force_flush)
 {
     s_call *current = NULL;
+
     S_;
 
     while_call_db(current)
     {
         if (current->ptype == PIPEWATCHERS)
         {
-	    D_("Calling pipewatcher plugin.\n");
+            D_("Calling pipewatcher plugin.\n");
             (*current->c.pipewatcher) (service, datalen, process,
                                        force_flush);
         }
@@ -79,6 +81,7 @@
                                  int program_end)
 {
     int forceflush, maxread, len;
+
     S_;
 
     forceflush = program_end;
@@ -124,7 +127,7 @@
      * before process are beeing freed, when the pocess
      * is dead.
      */
-    
+
     if (program_end)
     {
         int fd_flags;
@@ -154,8 +157,8 @@
     {
         /* Program is ending, close pipes */
         initng_plugin_readpipe(service, 0, x, TRUE);
-	
-	/* free data, close and reset fds */
+
+        /* free data, close and reset fds */
         D_("Freeing buffer for %s\n", service->name);
         if (x->stdout[0] > 0)
             close(x->stdout[0]);
@@ -200,7 +203,7 @@
     /* initziation */
     S_;
     FD_ZERO(&readset);
-    
+
     /* Set timeval struct, to our timeout */
     tv.tv_sec = timeout;
     tv.tv_usec = 0;
@@ -209,8 +212,8 @@
     /*
      * STEP 1:  Scan for fds to add
      */
-     
-     
+
+
     /* scan through active plugins that have listening file descriptors, and add them */
     while_call_db_safe(current, q)
     {
@@ -231,14 +234,14 @@
         {
             /*D_("adding fd #%i, from %s->start_process->stdout[0]\n", currentA->start_process->stdout[0], currentA->name); */
             FD_SET(currentA->start_process->stdout[0], &readset);
-	    added++;
+            added++;
         }
         if ((currentA->stop_process)
             && (currentA->stop_process->stdout[0] > 2))
         {
             /*D_("adding fd #%i, from %s->stop_process->stdout[0]\n", currentA->stop_process->stdout[0], currentA->name); */
             FD_SET(currentA->stop_process->stdout[0], &readset);
-	    added++;
+            added++;
         }
     }
 
@@ -246,9 +249,9 @@
     /*
      * STEP 2: Do the select-poll, if any fds where added
      */
-     
+
     /* check if there are any set */
-    if (added<=0)
+    if (added <= 0)
     {
         D_("No filedescriptors set.\n");
         sleep(timeout);
@@ -278,12 +281,12 @@
     /* none was found */
     if (retval == 0)
     {
-	D_("There was no data found on any added fd.\n");
+        D_("There was no data found on any added fd.\n");
         return (FALSE);
     }
 
     D_("%d fd's active\n", retval);
-    
+
     /* If a fsck is running select will always return one filehandler active, we give it 0.1 seconds to get some more data into the buffer. */
     sleep(0.1);
 

Modified: initng/src/initng_fork.c
==============================================================================
--- initng/src/initng_fork.c	(original)
+++ initng/src/initng_fork.c	Fri Sep 23 11:31:24 2005
@@ -79,7 +79,7 @@
         /* do a minimum sleep, to let the mother process 
            to register child, and notice death */
         usleep(ALL_USLEEP);
-	
+
 
         if (!initng_plugin_after_fork(service, process))
             _exit(1);
@@ -90,15 +90,16 @@
             setsid();                       /* Run a program in a new session ??? */
         }
 
-	/* this will redirect STDOUT and STDERR to where it belongs */
+        /* this will redirect STDOUT and STDERR to where it belongs */
         set_pipes(process);
 
-	/* close all open fds, exept STDIN, STDOUT, STDERR (0, 1, 2) */
-	{
-	    int i;
-	    for(i=3; i<=1013; i++)	
-		close(i);
-	}
+        /* close all open fds, exept STDIN, STDOUT, STDERR (0, 1, 2) */
+        {
+            int i;
+
+            for (i = 3; i <= 1013; i++)
+                close(i);
+        }
 
 
         if (g.i_am_init)

Modified: initng/src/initng_global.c
==============================================================================
--- initng/src/initng_global.c	(original)
+++ initng/src/initng_global.c	Fri Sep 23 11:31:24 2005
@@ -66,7 +66,7 @@
     INIT_LIST_HEAD(&g.service_cache.list);
     INIT_LIST_HEAD(&g.call_db.list);
     INIT_LIST_HEAD(&g.module_db.list);
-    /*INIT_LIST_HEAD(&g.history_db.list);*/
+    /*INIT_LIST_HEAD(&g.history_db.list); */
     INIT_LIST_HEAD(&g.option_db.list);
     INIT_LIST_HEAD(&g.command_db.list);
 
@@ -96,7 +96,7 @@
     int i;
 
     /* free all databases */
-    /*history_free_all();*/                     /* flush history log db */
+    /*history_free_all(); *//* flush history log db */
     active_db_free_all();                   /* clean process_db */
     service_db_free_all();                  /* clean service_cache_db */
     initng_sdt_free_all();                  /* clean option_db */

Modified: initng/src/initng_global.h
==============================================================================
--- initng/src/initng_global.h	(original)
+++ initng/src/initng_global.h	Fri Sep 23 11:31:24 2005
@@ -47,7 +47,7 @@
     s_call call_db;
     service_h service_cache;
     active_h active_database;
-    /*history_h history_db;*/
+    /*history_h history_db; */
     m_h module_db;
     s_entry option_db;
     s_command command_db;

Modified: initng/src/initng_main.c
==============================================================================
--- initng/src/initng_main.c	(original)
+++ initng/src/initng_main.c	Fri Sep 23 11:31:24 2005
@@ -76,7 +76,7 @@
     if (g.i_am_init && getpid() != 1)
     {
         F_("I AM NOT INIT, THIS CANT BE HAPPENING!\n");
-	sleep(3);
+        sleep(3);
         return;
     }
 
@@ -117,18 +117,21 @@
 
     if (sulogin_pid == 0)
     {
-	char *argv[] = { i_strdup("sulogin"), NULL };
+        char *argv[] = { i_strdup("sulogin"), NULL };
 
-	execve("/sbin/sulogin", argv, new_environ(NULL));   /* launch sulogin */
+        execve("/sbin/sulogin", argv, new_environ(NULL));       /* launch sulogin */
     }
 
     if (sulogin_pid > 0)
     {
-	do {
-	    sulogin_pid = waitpid(sulogin_pid, &status, WUNTRACED);
-	} while (!WIFEXITED(status) && !WIFSIGNALED(status));
-    } else 
-	_exit(1); /* sulogin unsuccessfull :( */
+        do
+        {
+            sulogin_pid = waitpid(sulogin_pid, &status, WUNTRACED);
+        }
+        while (!WIFEXITED(status) && !WIFSIGNALED(status));
+    }
+    else
+        _exit(1);                           /* sulogin unsuccessfull :( */
 }
 
 /*

Modified: initng/src/initng_plugin_callers.c
==============================================================================
--- initng/src/initng_plugin_callers.c	(original)
+++ initng/src/initng_plugin_callers.c	Fri Sep 23 11:31:24 2005
@@ -68,10 +68,10 @@
             return ("A_FORK");
         case HANDLE_KILLED:
             return ("HANDLE_KILLED");
-	case COMPENSATE_TIME:
-	    return ("COMPENSATE_TIME");
-	case ACTIVE_FREE:
-	    return ("ACTIVE_FREE");
+        case COMPENSATE_TIME:
+            return ("COMPENSATE_TIME");
+        case ACTIVE_FREE:
+            return ("ACTIVE_FREE");
     }
     return (NULL);
 }

Modified: initng/src/initng_service_cache.c
==============================================================================
--- initng/src/initng_service_cache.c	(original)
+++ initng/src/initng_service_cache.c	Fri Sep 23 11:31:24 2005
@@ -159,16 +159,17 @@
     service_h *current = service_db_find_by_exact_name(service);
 
     if (current)
-	return (current);
+        return (current);
 
     /* do pattern matching only if service name does not contain wildcards */
     if (strchr(service, '*') || strchr(service, '?'))
-	return (NULL);
+        return (NULL);
 
     current = NULL;
 
     /* create service name mask for pattern matching */
-    char *service_mask = initng_calloc(strlen(service)+3, sizeof(char));
+    char *service_mask = initng_calloc(strlen(service) + 3, sizeof(char));
+
     strcpy(service_mask, "*/");
     strcat(service_mask, service);
 
@@ -176,20 +177,21 @@
     {
         /* then try to find alike name */
 
-	/* if existing service is a pattern (i.e. net ) */
-	if (strchr(current->name, '*') || strchr(current->name, '?'))
-	{
-	    if (fnmatch(current->name, service, FNM_CASEFOLD) == 0)
-
-    	    {
-        	D_("service_db_find_by_name(%s): Found\n", current->name);
-		free(service_mask);
-        	return (current);
-	    }
-        } else if (fnmatch(service_mask, current->name, FNM_CASEFOLD) == 0)
+        /* if existing service is a pattern (i.e. net ) */
+        if (strchr(current->name, '*') || strchr(current->name, '?'))
+        {
+            if (fnmatch(current->name, service, FNM_CASEFOLD) == 0)
+
+            {
+                D_("service_db_find_by_name(%s): Found\n", current->name);
+                free(service_mask);
+                return (current);
+            }
+        }
+        else if (fnmatch(service_mask, current->name, FNM_CASEFOLD) == 0)
         {
             D_("service_db_find_by_name(%s): Found\n", current->name);
-	    free(service_mask);
+            free(service_mask);
             return (current);
         }
     }

Modified: initng/src/main.c
==============================================================================
--- initng/src/main.c	(original)
+++ initng/src/main.c	Fri Sep 23 11:31:24 2005
@@ -327,7 +327,7 @@
         {
             D_(" Now is before last time, clock was screwed backwards. Compensating for %i seconds.\n", last - now);
             active_db_compensate_time(last - now);
-	    initng_compensate_time_call(last - now);
+            initng_compensate_time_call(last - now);
         }
 
         /*
@@ -340,7 +340,7 @@
         {
             D_(" It has gone i hour sence last loop, this cant be true. Compensating for 3600 seconds.\n");
             active_db_compensate_time(3600);
-	    initng_compensate_time_call(3600);
+            initng_compensate_time_call(3600);
             last = last + 3600;
         }
         last = now;                         /* Remember last time */
@@ -361,14 +361,14 @@
             initng_signal_got_alarm || initng_signal_got_ctrl_alt_del)
             g.interrupt = TRUE;
 
-        
-           while (g.modules_to_unload==TRUE)
-           {
-           g.modules_to_unload=FALSE;
-           D_("There is modules to unload!\n");
-           initng_unload_marked_modules();
-           }
-        
+
+        while (g.modules_to_unload == TRUE)
+        {
+            g.modules_to_unload = FALSE;
+            D_("There is modules to unload!\n");
+            initng_unload_marked_modules();
+        }
+
 
 
 


More information about the Initng-svn mailing list