37 printf(
"Usage: %s [options]\n", prog_name);
38 printf(
"Application to forward information from the /proc/ file system to DLT.\n");
39 printf(
"%s\n", version);
42 printf(
" -c filename Use configuration file. \n");
44 printf(
" -h This help message.\n");
66 fprintf(stderr,
"%s: Nullpointer parameter\n", __func__);
72 while((opt = getopt(argc, argv,
"c:h")) != -1)
79 fprintf(stderr,
"Out of memory!\n");
94 fprintf(stderr,
"Unknown option: %c\n", optopt);
126 if(config ==
NULL || file_name ==
NULL)
128 fprintf(stderr,
"%s: Nullpointer parameter!\n", __func__);
134 file = fopen(file_name,
"r");
138 fprintf(stderr,
"%s: Could not open configuration file!\n", __func__);
152 fprintf(stderr,
"%s: Out of memory!\n", __func__);
161 pch = strtok (line,
" =\r\n");
179 pch = strtok(
NULL,
" =\r\n");
182 if(token[0] !=
'\0' && value[0] !=
'\0')
184 if(strcmp(token,
"process_interval") ==
'\0')
186 tmp = strtol(value, &strchk, 10);
188 if(strchk[0] ==
'\0' && tmp > 0)
191 fprintf(stderr,
"Error reading configuration file: %s is not a valid value for %s\n", value, token);
193 else if(strcmp(token,
"irq_interval") ==
'\0')
195 tmp = strtol(value, &strchk, 10);
197 if(strchk[0] ==
'\0' && tmp > 0)
200 fprintf(stderr,
"Error reading configuration file: %s is not a valid value for %s\n", value, token);
202 else if(strcmp(token,
"check_interval") ==
'\0')
204 tmp = strtol(value, &strchk, 10);
206 if(strchk[0] ==
'\0' && tmp > 0)
209 fprintf(stderr,
"Error reading configuration file: %s is not a valid value for %s\n", value, token);
211 else if(strcmp(token,
"log_level") ==
'\0')
213 tmp = strtol(value, &strchk, 10);
215 if(strchk[0] ==
'\0' && tmp >= -1 && tmp <= 6)
218 fprintf(stderr,
"Error reading configuration file: %s is not a valid value for %s\n", value, token);
239 fprintf(stderr,
"%s: Invalid Parameter!", __func__);
245 fprintf(stderr,
"Failed to read command line!");
251 fprintf(stderr,
"Failed to read configuration file!");
DltReturnValue dlt_kpi_init(int argc, char **argv, DltKpiConfig *config)
#define DEFAULT_CONF_FILE
#define COMMAND_LINE_SIZE
DltReturnValue dlt_kpi_read_command_line(DltKpiOptions *options, int argc, char **argv)
void usage(char *prog_name)
void dlt_kpi_init_configuration(DltKpiConfig *config)
DltLogLevelType log_level
void dlt_kpi_free_cli_options(DltKpiOptions *options)
void dlt_get_version(char *buf, size_t size)
void dlt_kpi_init_cli_options(DltKpiOptions *options)
char * configurationFileName
DltReturnValue dlt_kpi_read_configuration_file(DltKpiConfig *config, char *file_name)