16 #include <grass/gis.h>
22 static int (*ext_percent) (
int);
89 x = (d <= 0 || s <= 0)
90 ? 100 : (
int)(100 * n / d);
93 if (format == G_INFO_FORMAT_SILENT ||
G_verbose() < 1)
96 if (n <= 0 || n >= d || x > prev + s) {
103 if (format == G_INFO_FORMAT_STANDARD) {
105 fprintf(out,
"%4d%%\b\b\b\b\b", x);
109 if (format == G_INFO_FORMAT_PLAIN) {
112 fprintf(out,
"%d\n", x);
114 fprintf(out,
"%d..", x);
122 fprintf(out,
"GRASS_INFO_PERCENT: %d\n", x);
134 else if (format == G_INFO_FORMAT_STANDARD) {
168 ext_percent = percent_routine;
void G_set_percent_routine(int(*percent_routine)(int))
Establishes percent_routine as the routine that will handle the printing of percentage progress messa...
int G_percent2(long n, long d, int s, FILE *out)
Print percent complete messages.
int G_percent(long n, long d, int s)
Print percent complete messages.
int G_percent_reset(void)
Reset G_percent() to 0%; do not add newline.
int G_info_format(void)
Get current message format.
void G_unset_percent_routine(void)
After this call subsequent percentage progress messages will be handled in the default method...
int G_verbose(void)
Get current verbosity level.