Commit 79bf1f72 authored by Federico Vaga's avatar Federico Vaga

sw:tools: reduce variable scope

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 67988e8f
......@@ -63,12 +63,13 @@ static void help()
static int dump_message(struct polltrtl *p)
{
struct trtl_msg wmsg;
time_t tm;
char stime[64];
struct tm *gm;
int i, ret;
int ret;
if (timestamp) {
time_t tm;
struct tm *gm;
char stime[64];
tm = time(NULL);
gm = gmtime(&tm);
strftime(stime, 64,"%T", gm);
......@@ -88,6 +89,8 @@ static int dump_message(struct polltrtl *p)
if (protocol) {
trtl_print_message(&wmsg);
} else {
int i;
for (i = 0; i < wmsg.hdr.len; ++i) {
if (i % 4 == 0)
fprintf(stdout, "\n %04d :", i);
......@@ -111,7 +114,7 @@ void *message_thread(void *arg)
unsigned int cnt;
struct polltrtl p[1];
struct trtl_dev *trtl;
int ret, err;
int err;
/* Open the device */
trtl = trtl_open_by_id(th->devid);
......@@ -129,6 +132,8 @@ void *message_thread(void *arg)
/* Start dumping messages */
while (th->n == 0 || th->n > cnt) {
int ret;
/* Polling slots */
ret = trtl_msg_poll(p, 1, 1000);
switch (ret) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment