00001 /*- 00002 * G_clicker() 00003 * 00004 * Print a clock hand (one of '|', '/', '-', '\') to stderr. 00005 * Used in place of G_percent for unknown number of iterations 00006 * 00007 */ 00008 #include <stdio.h> 00009 00010 static int G_clicker_prev = 0; 00011 00012 int G_clicker (void) 00013 { 00014 int x; 00015 static char clicks[]="|/-\\"; 00016 00017 if (G_clicker_prev == -1 || G_clicker_prev == 3) 00018 x = 0; 00019 00020 else 00021 x = G_clicker_prev + 1; 00022 00023 fprintf (stderr, "%1c\b", clicks[x]); 00024 fflush (stderr); 00025 G_clicker_prev = x; 00026 00027 return 0; 00028 }