Patch to add a timestamping and version option to femon
Hi,
as I have been in need for a monitoring tool, to check the (in)stability of my SAT-DVB setup I came across femon of dvb-apps. As it doesn't has a timestamp option I haven't been able to correlate the outage of video with a signal reported by femon easily.
Therefore please find attached a patch which adds a timestamping option (-t) to femon.
It also adds a version option (-v) as you stated somewhere on your homepage this would be needed. Be carefull with the compiletime/date line. It will break the debian reproducable build system.
Kind regards
Daniel
34d33
< #include <time.h>
42,43d40
< #define TLEN 150
< #define VERSION "0.2"
54,56c51
< " -c number : samples to take (default 0 = infinite)\n" < " -v : display version information\n" < " -t : add timestamp for monitoring\n\n";
---
Quoted 1 line
" -c number : samples to take (default 0 = infinite)\n\n";
61d55
< char timebuf[TLEN];
69,74d62
< static void version(void)
< {
< printf("This is femon version %s\n", VERSION);
< printf("compiled at %s %s\n", __DATE__, __TIME__); /* remove for reproduceable builds */
< exit(1);
< }
77c65
< int check_frontend (struct dvbfe_handle *fe, int human_readable, unsigned int count, int timestamp)
---
Quoted 1 line
int
check_frontend(structdvbfe_handle*fe, inthuman_readable, unsigned int count)
82d69
< time_t curtime = time(NULL);
109,114c96
< if (timestamp) {
< curtime = time(NULL);
< strncpy(timebuf,ctime(&curtime),TLEN);
< timebuf[strlen(timebuf) - 1] = 0x00;
< printf("%s | ",timebuf);
< }
---
Quoted 1 line
166c148
< int do_mon(unsigned int adapter, unsigned int frontend, int human_readable, unsigned int count, int timestamp)
---
Quoted 1 line
int
do_mon(unsigned int adapter, unsigned int frontend, int human_readable, unsigned int count)
196c178
< result = check_frontend (fe, human_readable, count, timestamp);
---
Quoted 1 line
result = check_frontend (fe, human_readable, count);
208d189
< int timestamp = 0;
210c191
< while ((opt = getopt(argc, argv, "vrAHta:f:c:")) != -1) {
---
Quoted 1 line
while ((opt = getopt(argc, argv, "rAHa:f:c:")) != -1) {216,218d196
< case 'v':
< version();
< break;
240,242d217
< case 't':
< timestamp=1;
< break;
246c221
< do_mon(adapter, frontend, human_readable, count, timestamp);
---
Quoted 1 line
do_mon(adapter, frontend, human_readable, count);