GRASS GIS 8 Programmer's Manual 8.3.2(2024)-exported
Loading...
Searching...
No Matches
clicker.c
Go to the documentation of this file.
1/*-
2 * G_clicker()
3 *
4 * Print a clock hand (one of '|', '/', '-', '\') to stderr.
5 * Used in place of G_percent for unknown number of iterations
6 *
7 */
8#include <stdio.h>
9#include <grass/gis.h>
10
11static struct state {
12 int prev;
13} state;
14
15static struct state *st = &state;
16
17void G_clicker(void)
18{
19 static const char clicks[] = "|/-\\";
20 int format = G_info_format();
21
22 if (format == G_INFO_FORMAT_SILENT || G_verbose() < 1)
23 return;
24
25 st->prev++;
26 st->prev %= 4;
27
28 fprintf(stderr, "%1c\b", clicks[st->prev]);
29 fflush(stderr);
30}
void G_clicker(void)
Definition clicker.c:17
int G_info_format(void)
Get current message format.
Definition gis/error.c:537
int G_verbose(void)
Get current verbosity level.
Definition verbose.c:60