* [PATCH] candump: Add timeout option if no message has been received
@ 2013-02-12 10:31 Alexander Stein
2013-02-12 10:51 ` Marc Kleine-Budde
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2013-02-12 10:31 UTC (permalink / raw)
To: linux-can; +Cc: Alexander Stein
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
candump.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/candump.c b/candump.c
index bf3e8bb..7fce1d3 100644
--- a/candump.c
+++ b/candump.c
@@ -121,6 +121,7 @@ void print_usage(char *prg)
fprintf(stderr, " -d (monitor dropped CAN frames)\n");
fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
+ fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
fprintf(stderr, "\n");
fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
@@ -227,6 +228,7 @@ int main(int argc, char **argv)
int nbytes, i, maxdlen;
struct ifreq ifr;
struct timeval tv, last_tv;
+ struct timeval timeout, timeout_config, *timeout_current = NULL;
FILE *logfile = NULL;
signal(SIGTERM, sigterm);
@@ -236,7 +238,7 @@ int main(int argc, char **argv)
last_tv.tv_sec = 0;
last_tv.tv_usec = 0;
- while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:he?")) != -1) {
+ while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:heT:?")) != -1) {
switch (opt) {
case 't':
timestamp = optarg[0];
@@ -351,6 +353,16 @@ int main(int argc, char **argv)
}
break;
+ case 'T':
+ timeout_config.tv_usec = atoi(optarg);
+ if (timeout_config.tv_usec < 1) {
+ print_usage(basename(argv[0]));
+ exit(1);
+ }
+ timeout_config.tv_sec = timeout_config.tv_usec / 1000;
+ timeout_config.tv_usec = (timeout_config.tv_usec % 1000) * 1000;
+ timeout_current = &timeout;
+ break;
default:
print_usage(basename(argv[0]));
exit(1);
@@ -594,7 +606,10 @@ int main(int argc, char **argv)
for (i=0; i<currmax; i++)
FD_SET(s[i], &rdfs);
- if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, NULL)) < 0) {
+ if (timeout_current)
+ memcpy(timeout_current, &timeout_config, sizeof(timeout_config));
+
+ if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
//perror("select");
running = 0;
continue;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] candump: Add timeout option if no message has been received
2013-02-12 10:31 [PATCH] candump: Add timeout option if no message has been received Alexander Stein
@ 2013-02-12 10:51 ` Marc Kleine-Budde
2013-02-12 14:05 ` Alexander Stein
0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2013-02-12 10:51 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 3104 bytes --]
On 02/12/2013 11:31 AM, Alexander Stein wrote:
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
I get a new warning with your patch:
candump.c:231: warning: 'timeout_config' is used uninitialized in this
function
I think the compiler is not smart enough :)
> ---
> candump.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/candump.c b/candump.c
> index bf3e8bb..7fce1d3 100644
> --- a/candump.c
> +++ b/candump.c
> @@ -121,6 +121,7 @@ void print_usage(char *prg)
> fprintf(stderr, " -d (monitor dropped CAN frames)\n");
> fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
> fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
> + fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
> fprintf(stderr, "\n");
> fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
> fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
> @@ -227,6 +228,7 @@ int main(int argc, char **argv)
> int nbytes, i, maxdlen;
> struct ifreq ifr;
> struct timeval tv, last_tv;
> + struct timeval timeout, timeout_config, *timeout_current = NULL;
> FILE *logfile = NULL;
>
> signal(SIGTERM, sigterm);
> @@ -236,7 +238,7 @@ int main(int argc, char **argv)
> last_tv.tv_sec = 0;
> last_tv.tv_usec = 0;
>
> - while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:he?")) != -1) {
> + while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:heT:?")) != -1) {
> switch (opt) {
> case 't':
> timestamp = optarg[0];
> @@ -351,6 +353,16 @@ int main(int argc, char **argv)
> }
> break;
>
> + case 'T':
> + timeout_config.tv_usec = atoi(optarg);
tv_usec is a long, please use strtol() instead.
> + if (timeout_config.tv_usec < 1) {
> + print_usage(basename(argv[0]));
> + exit(1);
> + }
> + timeout_config.tv_sec = timeout_config.tv_usec / 1000;
> + timeout_config.tv_usec = (timeout_config.tv_usec % 1000) * 1000;
> + timeout_current = &timeout;
> + break;
> default:
> print_usage(basename(argv[0]));
> exit(1);
> @@ -594,7 +606,10 @@ int main(int argc, char **argv)
> for (i=0; i<currmax; i++)
> FD_SET(s[i], &rdfs);
>
> - if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, NULL)) < 0) {
> + if (timeout_current)
> + memcpy(timeout_current, &timeout_config, sizeof(timeout_config));
You may use:
*timeout_current = timeout_config;
instead.
> +
> + if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
> //perror("select");
> running = 0;
> continue;
>
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] candump: Add timeout option if no message has been received
2013-02-12 10:51 ` Marc Kleine-Budde
@ 2013-02-12 14:05 ` Alexander Stein
2013-02-12 14:07 ` Marc Kleine-Budde
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2013-02-12 14:05 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: linux-can
On Tuesday 12 February 2013 11:51:13, Marc Kleine-Budde wrote:
> On 02/12/2013 11:31 AM, Alexander Stein wrote:
> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
>
> I get a new warning with your patch:
>
> candump.c:231: warning: 'timeout_config' is used uninitialized in this
> function
>
> I think the compiler is not smart enough :)
Yeah, I think that too :) Which version did you use?
Both gcc 4.6.3 and clang 3.1 didn't complain.
Regards,
Alexander
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] candump: Add timeout option if no message has been received
2013-02-12 14:05 ` Alexander Stein
@ 2013-02-12 14:07 ` Marc Kleine-Budde
2013-02-12 14:17 ` [PATCH v2] " Alexander Stein
2013-02-12 16:50 ` [PATCH v3] " Alexander Stein
0 siblings, 2 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2013-02-12 14:07 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 863 bytes --]
On 02/12/2013 03:05 PM, Alexander Stein wrote:
> On Tuesday 12 February 2013 11:51:13, Marc Kleine-Budde wrote:
>> On 02/12/2013 11:31 AM, Alexander Stein wrote:
>>> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
>>
>> I get a new warning with your patch:
>>
>> candump.c:231: warning: 'timeout_config' is used uninitialized in this
>> function
>>
>> I think the compiler is not smart enough :)
>
> Yeah, I think that too :) Which version did you use?
> Both gcc 4.6.3 and clang 3.1 didn't complain.
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] candump: Add timeout option if no message has been received
2013-02-12 14:07 ` Marc Kleine-Budde
@ 2013-02-12 14:17 ` Alexander Stein
2013-02-12 14:19 ` Marc Kleine-Budde
2013-02-12 16:50 ` [PATCH v3] " Alexander Stein
1 sibling, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2013-02-12 14:17 UTC (permalink / raw)
To: linux-can; +Cc: Marc Kleine-Budde, Alexander Stein
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
Chanes in v2:
* Use strtol instead of atoi
* Change memcpy to direct struct copy
candump.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/candump.c b/candump.c
index bf3e8bb..7fce1d3 100644
--- a/candump.c
+++ b/candump.c
@@ -121,6 +121,7 @@ void print_usage(char *prg)
fprintf(stderr, " -d (monitor dropped CAN frames)\n");
fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
+ fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
fprintf(stderr, "\n");
fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
@@ -227,6 +228,7 @@ int main(int argc, char **argv)
int nbytes, i, maxdlen;
struct ifreq ifr;
struct timeval tv, last_tv;
+ struct timeval timeout, timeout_config, *timeout_current = NULL;
FILE *logfile = NULL;
signal(SIGTERM, sigterm);
@@ -236,7 +238,7 @@ int main(int argc, char **argv)
last_tv.tv_sec = 0;
last_tv.tv_usec = 0;
- while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:he?")) != -1) {
+ while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:heT:?")) != -1) {
switch (opt) {
case 't':
timestamp = optarg[0];
@@ -351,6 +353,16 @@ int main(int argc, char **argv)
}
break;
+ case 'T':
+ timeout_config.tv_usec = atoi(optarg);
+ if (timeout_config.tv_usec < 1) {
+ print_usage(basename(argv[0]));
+ exit(1);
+ }
+ timeout_config.tv_sec = timeout_config.tv_usec / 1000;
+ timeout_config.tv_usec = (timeout_config.tv_usec % 1000) * 1000;
+ timeout_current = &timeout;
+ break;
default:
print_usage(basename(argv[0]));
exit(1);
@@ -594,7 +606,10 @@ int main(int argc, char **argv)
for (i=0; i<currmax; i++)
FD_SET(s[i], &rdfs);
- if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, NULL)) < 0) {
+ if (timeout_current)
+ memcpy(timeout_current, &timeout_config, sizeof(timeout_config));
+
+ if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
//perror("select");
running = 0;
continue;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] candump: Add timeout option if no message has been received
2013-02-12 14:17 ` [PATCH v2] " Alexander Stein
@ 2013-02-12 14:19 ` Marc Kleine-Budde
0 siblings, 0 replies; 9+ messages in thread
From: Marc Kleine-Budde @ 2013-02-12 14:19 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 2944 bytes --]
On 02/12/2013 03:17 PM, Alexander Stein wrote:
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
> Chanes in v2:
> * Use strtol instead of atoi
> * Change memcpy to direct struct copy
Did you forget to squash your changes?
Marc
>
> candump.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/candump.c b/candump.c
> index bf3e8bb..7fce1d3 100644
> --- a/candump.c
> +++ b/candump.c
> @@ -121,6 +121,7 @@ void print_usage(char *prg)
> fprintf(stderr, " -d (monitor dropped CAN frames)\n");
> fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
> fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
> + fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
> fprintf(stderr, "\n");
> fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
> fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
> @@ -227,6 +228,7 @@ int main(int argc, char **argv)
> int nbytes, i, maxdlen;
> struct ifreq ifr;
> struct timeval tv, last_tv;
> + struct timeval timeout, timeout_config, *timeout_current = NULL;
> FILE *logfile = NULL;
>
> signal(SIGTERM, sigterm);
> @@ -236,7 +238,7 @@ int main(int argc, char **argv)
> last_tv.tv_sec = 0;
> last_tv.tv_usec = 0;
>
> - while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:he?")) != -1) {
> + while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:heT:?")) != -1) {
> switch (opt) {
> case 't':
> timestamp = optarg[0];
> @@ -351,6 +353,16 @@ int main(int argc, char **argv)
> }
> break;
>
> + case 'T':
> + timeout_config.tv_usec = atoi(optarg);
> + if (timeout_config.tv_usec < 1) {
> + print_usage(basename(argv[0]));
> + exit(1);
> + }
> + timeout_config.tv_sec = timeout_config.tv_usec / 1000;
> + timeout_config.tv_usec = (timeout_config.tv_usec % 1000) * 1000;
> + timeout_current = &timeout;
> + break;
> default:
> print_usage(basename(argv[0]));
> exit(1);
> @@ -594,7 +606,10 @@ int main(int argc, char **argv)
> for (i=0; i<currmax; i++)
> FD_SET(s[i], &rdfs);
>
> - if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, NULL)) < 0) {
> + if (timeout_current)
> + memcpy(timeout_current, &timeout_config, sizeof(timeout_config));
> +
> + if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
> //perror("select");
> running = 0;
> continue;
>
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3] candump: Add timeout option if no message has been received
2013-02-12 14:07 ` Marc Kleine-Budde
2013-02-12 14:17 ` [PATCH v2] " Alexander Stein
@ 2013-02-12 16:50 ` Alexander Stein
2013-02-12 16:56 ` Marc Kleine-Budde
1 sibling, 1 reply; 9+ messages in thread
From: Alexander Stein @ 2013-02-12 16:50 UTC (permalink / raw)
To: linux-can; +Cc: Marc Kleine-Budde, Alexander Stein
Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
Changes in v3 (v2 was bogus)
* Use strtol instead of atoi
* Change memcpy to direct struct copy
candump.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/candump.c b/candump.c
index bf3e8bb..457af9d 100644
--- a/candump.c
+++ b/candump.c
@@ -49,6 +49,7 @@
#include <ctype.h>
#include <libgen.h>
#include <time.h>
+#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
@@ -121,6 +122,7 @@ void print_usage(char *prg)
fprintf(stderr, " -d (monitor dropped CAN frames)\n");
fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
+ fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
fprintf(stderr, "\n");
fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
@@ -227,6 +229,7 @@ int main(int argc, char **argv)
int nbytes, i, maxdlen;
struct ifreq ifr;
struct timeval tv, last_tv;
+ struct timeval timeout, timeout_config, *timeout_current = NULL;
FILE *logfile = NULL;
signal(SIGTERM, sigterm);
@@ -236,7 +239,7 @@ int main(int argc, char **argv)
last_tv.tv_sec = 0;
last_tv.tv_usec = 0;
- while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:he?")) != -1) {
+ while ((opt = getopt(argc, argv, "t:ciaSs:b:B:u:ldxLn:r:heT:?")) != -1) {
switch (opt) {
case 't':
timestamp = optarg[0];
@@ -351,6 +354,17 @@ int main(int argc, char **argv)
}
break;
+ case 'T':
+ errno = 0;
+ timeout_config.tv_usec = strtol(optarg, NULL, 0);
+ if (errno != 0) {
+ print_usage(basename(argv[0]));
+ exit(1);
+ }
+ timeout_config.tv_sec = timeout_config.tv_usec / 1000;
+ timeout_config.tv_usec = (timeout_config.tv_usec % 1000) * 1000;
+ timeout_current = &timeout;
+ break;
default:
print_usage(basename(argv[0]));
exit(1);
@@ -594,7 +608,10 @@ int main(int argc, char **argv)
for (i=0; i<currmax; i++)
FD_SET(s[i], &rdfs);
- if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, NULL)) < 0) {
+ if (timeout_current)
+ *timeout_current = timeout_config;
+
+ if ((ret = select(s[currmax-1]+1, &rdfs, NULL, NULL, timeout_current)) <= 0) {
//perror("select");
running = 0;
continue;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3] candump: Add timeout option if no message has been received
2013-02-12 16:50 ` [PATCH v3] " Alexander Stein
@ 2013-02-12 16:56 ` Marc Kleine-Budde
2013-02-12 17:38 ` Oliver Hartkopp
0 siblings, 1 reply; 9+ messages in thread
From: Marc Kleine-Budde @ 2013-02-12 16:56 UTC (permalink / raw)
To: Alexander Stein; +Cc: linux-can
[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]
On 02/12/2013 05:50 PM, Alexander Stein wrote:
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
> Changes in v3 (v2 was bogus)
> * Use strtol instead of atoi
> * Change memcpy to direct struct copy
>
> candump.c | 21 +++++++++++++++++++--
> 1 file changed, 19 insertions(+), 2 deletions(-)
>
> diff --git a/candump.c b/candump.c
> index bf3e8bb..457af9d 100644
> --- a/candump.c
> +++ b/candump.c
> @@ -49,6 +49,7 @@
> #include <ctype.h>
> #include <libgen.h>
> #include <time.h>
> +#include <errno.h>
>
> #include <sys/time.h>
> #include <sys/types.h>
> @@ -121,6 +122,7 @@ void print_usage(char *prg)
> fprintf(stderr, " -d (monitor dropped CAN frames)\n");
> fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
> fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
> + fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
> fprintf(stderr, "\n");
> fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
> fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
> @@ -227,6 +229,7 @@ int main(int argc, char **argv)
> int nbytes, i, maxdlen;
> struct ifreq ifr;
> struct timeval tv, last_tv;
> + struct timeval timeout, timeout_config, *timeout_current = NULL;
I'll change this into
struct timeval timeout, timeout_config = { 0, 0 }, *timeout_current = NULL;
To make my old compiler happy.
Applied.
tnx,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3] candump: Add timeout option if no message has been received
2013-02-12 16:56 ` Marc Kleine-Budde
@ 2013-02-12 17:38 ` Oliver Hartkopp
0 siblings, 0 replies; 9+ messages in thread
From: Oliver Hartkopp @ 2013-02-12 17:38 UTC (permalink / raw)
To: Marc Kleine-Budde, Alexander Stein; +Cc: linux-can
On 12.02.2013 17:56, Marc Kleine-Budde wrote:
> On 02/12/2013 05:50 PM, Alexander Stein wrote:
>> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
>> ---
>> Changes in v3 (v2 was bogus)
>> * Use strtol instead of atoi
>> * Change memcpy to direct struct copy
>>
>> candump.c | 21 +++++++++++++++++++--
>> 1 file changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/candump.c b/candump.c
>> index bf3e8bb..457af9d 100644
>> --- a/candump.c
>> +++ b/candump.c
>> @@ -49,6 +49,7 @@
>> #include <ctype.h>
>> #include <libgen.h>
>> #include <time.h>
>> +#include <errno.h>
>>
>> #include <sys/time.h>
>> #include <sys/types.h>
>> @@ -121,6 +122,7 @@ void print_usage(char *prg)
>> fprintf(stderr, " -d (monitor dropped CAN frames)\n");
>> fprintf(stderr, " -e (dump CAN error frames in human-readable format)\n");
>> fprintf(stderr, " -x (print extra message infos, rx/tx brs esi)\n");
>> + fprintf(stderr, " -T <msecs> (terminate after <msecs> without any reception)\n");
>> fprintf(stderr, "\n");
>> fprintf(stderr, "Up to %d CAN interfaces with optional filter sets can be specified\n", MAXSOCK);
>> fprintf(stderr, "on the commandline in the form: <ifname>[,filter]*\n");
>> @@ -227,6 +229,7 @@ int main(int argc, char **argv)
>> int nbytes, i, maxdlen;
>> struct ifreq ifr;
>> struct timeval tv, last_tv;
>> + struct timeval timeout, timeout_config, *timeout_current = NULL;
>
> I'll change this into
> struct timeval timeout, timeout_config = { 0, 0 }, *timeout_current = NULL;
>
> To make my old compiler happy.
>
> Applied.
Fine :-)
A funny feature.
Tnx,
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-02-12 17:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12 10:31 [PATCH] candump: Add timeout option if no message has been received Alexander Stein
2013-02-12 10:51 ` Marc Kleine-Budde
2013-02-12 14:05 ` Alexander Stein
2013-02-12 14:07 ` Marc Kleine-Budde
2013-02-12 14:17 ` [PATCH v2] " Alexander Stein
2013-02-12 14:19 ` Marc Kleine-Budde
2013-02-12 16:50 ` [PATCH v3] " Alexander Stein
2013-02-12 16:56 ` Marc Kleine-Budde
2013-02-12 17:38 ` Oliver Hartkopp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.