]> git.itanic.dy.fi Git - glucose/commitdiff
main: Print how many entries we have read from the meter
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 24 Jun 2011 15:55:34 +0000 (18:55 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 24 Jun 2011 15:55:34 +0000 (18:55 +0300)
This makes it easier for an inpatient user to wait until all the
readings have been taken out from the device.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
main.c

diff --git a/main.c b/main.c
index 888c33965a2b28e9de9fac1f469dfe2231d0532d..6e876025aad2f814d576be8a73830856f9160c9f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -19,6 +19,7 @@ int main(int argc, char *argv[])
        struct user_options opts;
        struct msg msg;
        int fd, usage_code, ret, error;
+       int entries = 0;
 
        read_args(argc, argv, &opts);
 
@@ -56,7 +57,14 @@ int main(int argc, char *argv[])
                        break;
 
                fprintf(outf, "%s\n", msg.data);
+
+               entries++;
+               if (outf != stdout) {
+                       trace(0, "\r%d", entries);
+                       fflush(stdout);
+               }
        }
+       trace(0, "\n");
 
        return 0;
 }