GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
verbose.c
Go to the documentation of this file.
1 
22 #include <stdlib.h>
23 #include <grass/config.h>
24 
25 #define MAXLEVEL 3
26 #define STDLEVEL 2
27 #define MINLEVEL 0
28 
29 
30 static int verbose = -1; /* current verbosity level */
31 
32 
45 int G_verbose(void)
46 {
47  char *verstr; /* string for GRASS_VERBOSE content */
48 
49  /* verbose not defined -> get it from env. */
50  if (verbose < 0) {
51 
52  if ((verstr = getenv("GRASS_VERBOSE"))) {
53  if ((verbose = atoi(verstr))) ;
54  }
55  else
56  verbose = STDLEVEL;
57  }
58  return verbose;
59 }
60 
61 
68 int G_verbose_max(void)
69 {
70  return MAXLEVEL;
71 }
72 
73 
80 int G_verbose_std(void)
81 {
82  return STDLEVEL;
83 }
84 
85 
92 int G_verbose_min(void)
93 {
94  return MINLEVEL;
95 }
96 
106 int G_set_verbose(int level)
107 {
108  if (level >= MINLEVEL && level <= MAXLEVEL) {
109  verbose = level;
110  return 1;
111  }
112 
113  return 0;
114 }
#define MINLEVEL
Definition: verbose.c:27
#define MAXLEVEL
Definition: verbose.c:25
int G_set_verbose(int level)
Set verbosity level.
Definition: verbose.c:106
char * getenv()
int G_verbose_max(void)
Get max verbosity level.
Definition: verbose.c:68
int G_verbose_std(void)
Get standard verbosity level.
Definition: verbose.c:80
int G_verbose(void)
Get current verbosity level.
Definition: verbose.c:45
#define STDLEVEL
Definition: verbose.c:26
int G_verbose_min(void)
Get min verbosity level.
Definition: verbose.c:92