GRASS Programmer's Manual  6.4.2(2012)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
clicker.c
Go to the documentation of this file.
1 
2 /*-
3  * G_clicker()
4  *
5  * Print a clock hand (one of '|', '/', '-', '\') to stderr.
6  * Used in place of G_percent for unknown number of iterations
7  *
8  */
9 #include <stdio.h>
10 
11 static int G_clicker_prev = 0;
12 
13 int G_clicker(void)
14 {
15  int x;
16  static char clicks[] = "|/-\\";
17 
18  if (G_clicker_prev == -1 || G_clicker_prev == 3)
19  x = 0;
20 
21  else
22  x = G_clicker_prev + 1;
23 
24  fprintf(stderr, "%1c\b", clicks[x]);
25  fflush(stderr);
26  G_clicker_prev = x;
27 
28  return 0;
29 }