summaryrefslogtreecommitdiff
path: root/src/examples/dlt-example-user.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/dlt-example-user.c')
-rw-r--r--src/examples/dlt-example-user.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/examples/dlt-example-user.c b/src/examples/dlt-example-user.c
index 6ede605..8c79c42 100644
--- a/src/examples/dlt-example-user.c
+++ b/src/examples/dlt-example-user.c
@@ -98,6 +98,7 @@ void usage()
printf("Options:\n");
printf(" -d delay Milliseconds to wait between sending messages (Default: 500)\n");
printf(" -f filename Use local log file instead of sending to daemon\n");
+ printf(" -S filesize Set maximum size of local log file (Default: UINT_MAX)\n");
printf(" -n count Number of messages to be generated (Default: 10)\n");
printf(" -g Switch to non-verbose mode (Default: verbose mode)\n");
printf(" -a Enable local printing of DLT messages (Default: disabled)\n");
@@ -130,6 +131,7 @@ int main(int argc, char *argv[])
#endif /* DLT_TEST_ENABLE */
char *dvalue = 0;
char *fvalue = 0;
+ unsigned int filesize = 0;
char *nvalue = 0;
char *mvalue = 0;
char *message = 0;
@@ -152,10 +154,10 @@ int main(int argc, char *argv[])
opterr = 0;
#ifdef DLT_TEST_ENABLE
- while ((c = getopt (argc, argv, "vgakcd:f:n:m:z:r:s:l:t:A:C:")) != -1)
+ while ((c = getopt (argc, argv, "vgakcd:f:S:n:m:z:r:s:l:t:A:C:")) != -1)
#else
- while ((c = getopt (argc, argv, "vgakd:f:n:m:l:r:t:A:C:")) != -1)
+ while ((c = getopt (argc, argv, "vgakd:f:S:n:m:l:r:t:A:C:")) != -1)
#endif /* DLT_TEST_ENABLE */
{
switch (c) {
@@ -201,6 +203,11 @@ int main(int argc, char *argv[])
fvalue = optarg;
break;
}
+ case 'S':
+ {
+ filesize = atoi(optarg);
+ break;
+ }
case 'n':
{
nvalue = optarg;
@@ -238,7 +245,8 @@ int main(int argc, char *argv[])
}
case '?':
{
- if ((optopt == 'd') || (optopt == 'f') || (optopt == 'n') || (optopt == 'l') || (optopt == 't'))
+ if ((optopt == 'd') || (optopt == 'f') || (optopt == 'n') ||
+ (optopt == 'l') || (optopt == 't') || (optopt == 'S'))
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
@@ -279,6 +287,11 @@ int main(int argc, char *argv[])
return -1;
}
+ if (filesize != 0) {
+ if (dlt_set_filesize_max(filesize) < 0)
+ return -1;
+ }
+
dlt_with_session_id(1);
dlt_with_timestamp(1);
dlt_with_ecu_id(1);