42 printf(
"Usage: %s [options]\n", prog_name);
43 printf(
"Application to forward dbus messages to DLT.\n");
44 printf(
"%s\n", version);
46 printf(
" -d Daemonize. Detach from terminal and run in background.\n");
47 printf(
" -c filename Use configuration file. \n");
48 printf(
" -a appid Used application id. \n");
50 printf(
" -b type Used bus type. \n");
51 printf(
" Session = 0, System = 1.\n");
52 printf(
" -h This help message.\n");
74 while((opt = getopt(argc, argv,
"c:b:a:hd")) != -1)
84 options->
BusType = malloc(strlen(optarg)+1);
86 strcpy(options->
BusType, optarg);
111 fprintf(stderr,
"Unknown option '%c'\n", optopt);
141 char *line, *token, *value, *filter, *pch;
143 char *filterBegin,*filterEnd;
147 file = fopen(file_name,
"r");
151 fprintf(stderr,
"dlt-dbus-options, could not open configuration file.\n");
171 filterBegin = strchr(line,
'=');
172 filterEnd = strpbrk (line,
"\r\n");
176 if(filterEnd && (filterEnd>filterBegin))
178 strncpy(filter,filterBegin+1,filterEnd-filterBegin-1);
179 filter[filterEnd-filterBegin-1]=0;
183 strcpy(filter,filterBegin+1);
187 pch = strtok (line,
" =\r\n");
205 pch = strtok (
NULL,
" =\r\n");
208 if(token[0] && value[0])
211 if(strcmp(token,
"ApplicationId") == 0)
218 else if(strcmp(token,
"ContextId") == 0)
225 else if(strcmp(token,
"BusType") == 0)
232 else if(strcmp(token,
"FilterMatch") == 0)
#define DLT_DBUS_FILTER_MAX
#define DEFAULT_CONF_FILE
char * FilterMatch[DLT_DBUS_FILTER_MAX]
void usage(char *prog_name)
char * ConfigurationFileName
void init_cli_options(DltDBusCliOptions *options)
int read_configuration_file(DltDBusConfiguration *config, char *file_name)
void init_configuration(DltDBusConfiguration *config)
int read_command_line(DltDBusCliOptions *options, int argc, char *argv[])
void dlt_get_version(char *buf, size_t size)