|
GRASS Programmer's Manual
6.5.svn(2012)-r51648
|
00001 00002 /*- 00003 * G_clicker() 00004 * 00005 * Print a clock hand (one of '|', '/', '-', '\') to stderr. 00006 * Used in place of G_percent for unknown number of iterations 00007 * 00008 */ 00009 #include <stdio.h> 00010 #include <grass/gis.h> 00011 00012 static int G_clicker_prev = 0; 00013 00014 int G_clicker(void) 00015 { 00016 int x, format; 00017 static char clicks[] = "|/-\\"; 00018 00019 /* be verbose only 1> */ 00020 format = G_info_format(); 00021 if (format == G_INFO_FORMAT_SILENT || G_verbose() < 1) 00022 return 0; 00023 00024 if (G_clicker_prev == -1 || G_clicker_prev == 3) 00025 x = 0; 00026 else 00027 x = G_clicker_prev + 1; 00028 00029 fprintf(stderr, "%1c\b", clicks[x]); 00030 fflush(stderr); 00031 G_clicker_prev = x; 00032 00033 return 0; 00034 }