71 printf(
"Usage: %s [options]\n", prog_name);
72 printf(
"Application to forward syslog messages to DLT, transfer system information, logs and files.\n");
73 printf(
"%s\n", version);
75 printf(
" -d Daemonize. Detach from terminal and run in background.\n");
76 printf(
" -c filename Use configuration file. \n");
78 printf(
" -h This help message.\n");
98 while((opt = getopt(argc, argv,
"c:hd")) != -1)
121 fprintf(stderr,
"Unknown option '%c'\n", optopt);
199 char *line, *token, *value, *pch;
204 file = fopen(file_name,
"r");
208 fprintf(stderr,
"dlt-system-options, could not open configuration file.\n");
225 pch = strtok (line,
" =\r\n");
243 pch = strtok (
NULL,
" =\r\n");
246 if(token[0] && value[0])
249 if(strcmp(token,
"ApplicationId") == 0)
257 else if(strcmp(token,
"ShellEnable") == 0)
263 else if(strcmp(token,
"SyslogEnable") == 0)
267 else if(strcmp(token,
"SyslogContextId") == 0)
273 else if(strcmp(token,
"SyslogPort") == 0)
279 else if(strcmp(token,
"JournalEnable") == 0)
283 else if(strcmp(token,
"JournalContextId") == 0)
289 else if(strcmp(token,
"JournalCurrentBoot") == 0)
293 else if(strcmp(token,
"JournalFollow") == 0)
297 else if(strcmp(token,
"JournalMapLogLevels") == 0)
303 else if(strcmp(token,
"FiletransferEnable") == 0)
307 else if(strcmp(token,
"FiletransferContextId") == 0)
313 else if(strcmp(token,
"FiletransferTimeStartup") == 0)
317 else if(strcmp(token,
"FiletransferTimeDelay") == 0)
321 else if(strcmp(token,
"FiletransferTimeoutBetweenLogs") == 0)
325 else if(strcmp(token,
"FiletransferTempDir") == 0)
331 else if(strcmp(token,
"FiletransferDirectory") == 0)
337 else if(strcmp(token,
"FiletransferCompression") == 0)
341 else if(strcmp(token,
"FiletransferCompressionLevel") == 0)
351 "Too many file transfer directories configured. Maximum: %d\n",
359 else if(strcmp(token,
"LogFileEnable") == 0)
363 else if(strcmp(token,
"LogFileFilename") == 0)
369 else if(strcmp(token,
"LogFileMode") == 0)
373 else if(strcmp(token,
"LogFileTimeDelay") == 0)
377 else if(strcmp(token,
"LogFileContextId") == 0)
389 "Too many log files configured. Maximum: %d\n",
398 else if(strcmp(token,
"LogProcessesEnable") == 0)
402 else if(strcmp(token,
"LogProcessesContextId") == 0)
408 else if(strcmp(token,
"LogProcessName") == 0)
414 else if(strcmp(token,
"LogProcessFilename") == 0)
420 else if(strcmp(token,
"LogProcessMode") == 0)
424 else if(strcmp(token,
"LogProcessTimeDelay") == 0)
434 "Too many processes to log configured. Maximum: %d\n",
void init_cli_options(DltSystemCliOptions *options)
#define DEFAULT_CONF_FILE
int Mode[DLT_SYSTEM_LOG_FILE_MAX]
int read_configuration_file(DltSystemConfiguration *config, char *file_name)
#define DLT_SYSTEM_LOG_PROCESSES_MAX
int CompressionLevel[DLT_SYSTEM_LOG_DIRS_MAX]
#define DLT_SYSTEM_LOG_DIRS_MAX
char * Directory[DLT_SYSTEM_LOG_DIRS_MAX]
void init_configuration(DltSystemConfiguration *config)
FiletransferOptions Filetransfer
int Mode[DLT_SYSTEM_LOG_PROCESSES_MAX]
int Compression[DLT_SYSTEM_LOG_DIRS_MAX]
int read_command_line(DltSystemCliOptions *options, int argc, char *argv[])
int TimeDelay[DLT_SYSTEM_LOG_PROCESSES_MAX]
char * ContextId[DLT_SYSTEM_LOG_FILE_MAX]
char * Filename[DLT_SYSTEM_LOG_FILE_MAX]
void dlt_get_version(char *buf, size_t size)
int TimeDelay[DLT_SYSTEM_LOG_FILE_MAX]
char * ConfigurationFileName
LogProcessOptions LogProcesses
char * Filename[DLT_SYSTEM_LOG_PROCESSES_MAX]
void usage(char *prog_name)
char * Name[DLT_SYSTEM_LOG_PROCESSES_MAX]
#define DLT_SYSTEM_LOG_FILE_MAX