GRASS Programmer's Manual  6.5.svn(2014)-r66266
 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 #include <grass/gis.h>
11 
12 static int G_clicker_prev = 0;
13 
14 int G_clicker(void)
15 {
16  int x, format;
17  static char clicks[] = "|/-\\";
18 
19  /* be verbose only 1> */
20  format = G_info_format();
21  if (format == G_INFO_FORMAT_SILENT || G_verbose() < 1)
22  return 0;
23 
24  if (G_clicker_prev == -1 || G_clicker_prev == 3)
25  x = 0;
26  else
27  x = G_clicker_prev + 1;
28 
29  fprintf(stderr, "%1c\b", clicks[x]);
30  fflush(stderr);
31  G_clicker_prev = x;
32 
33  return 0;
34 }
int G_clicker(void)
Definition: clicker.c:14
int G_info_format(void)
Get current message format.
int G_verbose(void)
Get current verbosity level.
Definition: verbose.c:45