1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/types.h>
4 #include <unistd.h>
5 #include <time.h>
6 #include <stdarg.h>
7 #include <grass/gis.h>
8 
9 #include "raster3d_intern.h"
10 
11 /*---------------------------------------------------------------------------*/
12 
13 
14 /*!
15  * \brief This function ignores the error.
16  *
17  *  \param msg
18  *  \return void
19  */
20 
Rast3d_skip_error(const char * msg)21 void Rast3d_skip_error(const char *msg)
22 {
23 }
24 
25 
26 /*!
27  * \brief Prints error message
28  *
29  *  This function prints the
30  *  error message <em>msg</em> to <em>stderr</em> and returns.
31  *
32  *  \param msg
33  *  \return void
34  */
35 
Rast3d_print_error(const char * msg)36 void Rast3d_print_error(const char *msg)
37 {
38     fprintf(stderr, "ERROR: ");
39     fprintf(stderr, "%s", msg);
40     fprintf(stderr, "\n");
41 }
42 
43 
44 /*!
45  * \brief Prints fatal error message
46  *
47  *  This function prints the fatal
48  *  error message <em>msg</em>, and terminates the program with an error status.
49  *
50  *  \param msg
51  *  \return void
52  */
53 
Rast3d_fatal_error(const char * msg,...)54 void Rast3d_fatal_error(const char *msg, ...)
55 {
56     char buffer[2000];		/* No novels to the error logs, OK? */
57     va_list ap;
58 
59     va_start(ap, msg);
60     vsprintf(buffer, msg, ap);
61     va_end(ap);
62 
63     G_fatal_error("%s", buffer);
64 }
65 
Rast3d_fatal_error_noargs(const char * msg)66 void Rast3d_fatal_error_noargs(const char *msg)
67 {
68     G_fatal_error("%s", msg);
69 }
70 
Rast3d_error(const char * msg,...)71 void Rast3d_error(const char *msg, ...)
72 {
73     char buffer[2000];		/* No novels to the error logs, OK? */
74     va_list ap;
75 
76     va_start(ap, msg);
77     vsprintf(buffer, msg, ap);
78     va_end(ap);
79 
80     (*g3d_error_fun) (buffer);
81 }
82