GRASS GIS 8 Programmer's Manual
8.2.2dev(2023)-3d2c704037
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
struct
state
{
13
int
prev;
14
}
state
;
15
16
static
struct
state
*
st
= &
state
;
17
18
void
G_clicker
(
void
)
19
{
20
static
const
char
clicks[] =
"|/-\\"
;
21
int
format =
G_info_format
();
22
23
if
(format ==
G_INFO_FORMAT_SILENT
||
G_verbose
() < 1)
24
return
;
25
26
st->prev++;
27
st->prev %= 4;
28
29
fprintf(stderr,
"%1c\b"
, clicks[st->prev]);
30
fflush(stderr);
31
}
G_verbose
int G_verbose(void)
Get current verbosity level.
Definition:
verbose.c:55
gis.h
st
struct state * st
Definition:
parser.c:104
G_INFO_FORMAT_SILENT
#define G_INFO_FORMAT_SILENT
Definition:
gis.h:372
G_clicker
void G_clicker(void)
Definition:
clicker.c:18
G_info_format
int G_info_format(void)
Get current message format.
Definition:
gis/error.c:532
state
struct state state
Definition:
parser.c:103
lib
gis
clicker.c
Generated on Tue Feb 14 2023 05:55:58 for GRASS GIS 8 Programmer's Manual by
1.8.13