]> git.neil.brown.name Git - gta04-gsm-voice-routing.git/commitdiff
show progress while routing
authorRadek Polak <psonek2@seznam.cz>
Sat, 4 Feb 2012 23:02:22 +0000 (00:02 +0100)
committerRadek Polak <psonek2@seznam.cz>
Sat, 4 Feb 2012 23:02:22 +0000 (00:02 +0100)
gsm-voice-routing.c

index 9529d0d808e286ed777aa64e2c7f352693510b94..a2481a7548d20cabf4b1a5e29c305dbe7fb1b83d 100644 (file)
@@ -321,6 +321,15 @@ void log_with_timestamp(const char *msg)
     fprintf(logfile, "%d %d: %s\n", tp.tv_sec, tp.tv_nsec, msg);
 }
 
+void show_progress()
+{
+    static int counter = 0;
+    char ch = "|\\-/"[(counter++) % 4];
+    fputc(ch, logfile);
+    fputc('\b', logfile);
+    fflush(logfile);
+}
+
 int main()
 {
     int rc;
@@ -412,7 +421,9 @@ int main()
             continue;
         }
 
-        if(!started) {
+        if (started) {
+            show_progress();
+        } else {
             fprintf(logfile, "voice routing started\n");
             started = 1;
         }