91 #define DLT_CONVERT_TEXTBUFSIZE 10024 102 printf(
"Usage: dlt-convert [options] [commands] file1 [file2]\n");
103 printf(
"Read DLT files, print DLT messages as ASCII and store the messages again.\n");
104 printf(
"Use filters to filter DLT messages.\n");
105 printf(
"Use Ranges and Output file to cut DLT files.\n");
106 printf(
"Use two files and Output file to join DLT files.\n");
107 printf(
"%s \n", version);
108 printf(
"Commands:\n");
109 printf(
" -h Usage\n");
110 printf(
" -a Print DLT file; payload as ASCII\n");
111 printf(
" -x Print DLT file; payload as hex\n");
112 printf(
" -m Print DLT file; payload as hex and ASCII\n");
113 printf(
" -s Print DLT file; only headers\n");
114 printf(
" -o filename Output messages in new DLT file\n");
115 printf(
"Options:\n");
116 printf(
" -v Verbose mode\n");
117 printf(
" -c Count number of messages\n");
118 printf(
" -f filename Enable filtering of messages\n");
119 printf(
" -b number First messages to be handled\n");
120 printf(
" -e number Last message to be handled\n");
121 printf(
" -w Follow dlt file while file is increasing\n");
127 int main(
int argc,
char* argv[])
158 while ((c = getopt (argc, argv,
"vcashxmwf:b:e:o:")) != -1)
223 if (optopt ==
'f' || optopt ==
'b' || optopt ==
'e' || optopt ==
'o')
225 fprintf (stderr,
"Option -%c requires an argument.\n", optopt);
227 else if (isprint (optopt))
229 fprintf (stderr,
"Unknown option `-%c'.\n", optopt);
233 fprintf (stderr,
"Unknown option character `\\x%x'.\n",optopt);
263 ohandle = open(ovalue,O_WRONLY|O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
267 fprintf(stderr,
"ERROR: Output file %s cannot be opened!\n",ovalue);
273 for (index = optind; index < argc; index++)
283 if (aflag || sflag || xflag || mflag || ovalue)
287 begin = atoi(bvalue);
294 if (evalue && (wflag==0))
303 if (begin<0 || begin>=file.
counter)
305 fprintf(stderr,
"ERROR: Selected first message %d is out of range!\n",begin);
308 if (end<0 || end>=file.
counter || end<begin)
310 fprintf(stderr,
"ERROR: Selected end message %d is out of range!\n",end);
313 for (num = begin; num <= end ;num++)
332 printf(
"[%s]\n",text);
345 printf(
"%s \n",text);
356 bytes_written = writev(ohandle, iov, 2);
357 if (0 > bytes_written){
358 printf(
"in main: writev(ohandle, iov, 2); returned an error!" );
365 if (wflag && num==end)
392 printf(
"Filtered number of messages: %d\n",file.
counter);
403 fprintf(stderr,
"ERROR: No file selected\n");
DltReturnValue dlt_file_open(DltFile *file, const char *filename, int verbose)
DltReturnValue dlt_file_message(DltFile *file, int index, int verbose)
DltReturnValue dlt_file_set_filter(DltFile *file, DltFilter *filter, int verbose)
DltReturnValue dlt_file_read(DltFile *file, int verbose)
#define DLT_CONVERT_TEXTBUFSIZE
DltReturnValue dlt_filter_load(DltFilter *filter, const char *filename, int verbose)
uint8_t headerbuffer[sizeof(DltStorageHeader)+sizeof(DltStandardHeader)+sizeof(DltStandardHeaderExtra)+sizeof(DltExtendedHeader)]
DltReturnValue dlt_file_init(DltFile *file, int verbose)
DltReturnValue dlt_message_payload(DltMessage *msg, char *text, int textlength, int type, int verbose)
DltReturnValue dlt_file_free(DltFile *file, int verbose)
void dlt_get_version(char *buf, size_t size)
DltReturnValue dlt_message_header(DltMessage *msg, char *text, int textlength, int verbose)
DltReturnValue dlt_message_print_hex(DltMessage *message, char *text, uint32_t size, int verbose)
int main(int argc, char *argv[])
DltReturnValue dlt_message_print_mixed_plain(DltMessage *message, char *text, uint32_t size, int verbose)