30 #include <rdk_logger_types.h>
32 #include "rdk_error.h"
42 #include <sys/reboot.h>
43 #include <linux/reboot.h>
60 static void trim(
char *instr,
char* outstr)
63 char *endptr = instr + strlen(instr)-1;
81 while (isspace(*endptr))
84 length = endptr + 1 - ptr;
85 strncpy(outstr,ptr,length);
86 outstr[length] =
'\0';
99 const int line_buf_len = 256;
100 static int number = 0;
103 char lineBuffer[line_buf_len];
106 if ((f = fopen( path,
"r")) == NULL)
108 printf(
"***************************************************\n");
109 printf(
"***************************************************\n");
110 printf(
"** ERROR! Could not open configuration file! **\n");
111 printf(
"***************************************************\n");
112 printf(
"***************************************************\n");
113 printf(
"(Tried %s\n", path);
116 printf(
"Conf file %s open success\n", path);
119 while (fgets(lineBuffer,line_buf_len,f) != NULL)
121 char name[line_buf_len];
122 char value[line_buf_len];
123 char trimname[line_buf_len];
124 char trimvalue[line_buf_len];
131 if (lineBuffer[0] ==
'#')
135 if ((equals = strchr(lineBuffer,
'=')) == NULL)
139 length = equals - lineBuffer;
140 strncpy( name,lineBuffer,length);
141 name[ length] =
'\0';
143 length = lineBuffer + strlen(lineBuffer) - equals + 1;
144 strncpy( value,equals+1,length);
145 value[ length] =
'\0' ;
148 trim( name,trimname);
149 trim( value,trimvalue);
151 tmp_node = g_envCache;
154 if(strcmp(tmp_node->name, trimname) == 0)
158 tmp_node = tmp_node->next;
164 node->name = strdup( trimname);
165 node->value = strdup( trimvalue);
169 free(tmp_node->value);
170 tmp_node->value = strdup( trimvalue);
175 if ((strcmp(
"LOG.RDK.DEFAULT",node->name) != 0) &&
176 (strcmp(
"EnableMPELog",node->name) != 0) &&
177 (strcmp(
"SEPARATE.LOGFILE.SUPPORT",node->name) != 0))
180 node->number = number;
185 node->next = g_envCache;
210 if (strcmp(name,node->name) == 0)
238 if (number == node->number)
264 if (strcmp(mod,node->name) == 0)
292 if (Num == node->number)