GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-3a95b7a4e6
raster3d/error.c
Go to the documentation of this file.
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  * \brief This function ignores the error.
15  *
16  * \param msg
17  * \return void
18  */
19 
20 void Rast3d_skip_error(const char *msg UNUSED)
21 {
22 }
23 
24 /*!
25  * \brief Prints error message
26  *
27  * This function prints the
28  * error message <em>msg</em> to <em>stderr</em> and returns.
29  *
30  * \param msg
31  * \return void
32  */
33 
34 void Rast3d_print_error(const char *msg)
35 {
36  fprintf(stderr, "ERROR: ");
37  fprintf(stderr, "%s", msg);
38  fprintf(stderr, "\n");
39 }
40 
41 /*!
42  * \brief Prints fatal error message
43  *
44  * This function prints the fatal
45  * error message <em>msg</em>, and terminates the program with an error status.
46  *
47  * \param msg
48  * \return void
49  */
50 
51 void Rast3d_fatal_error(const char *msg, ...)
52 {
53  char buffer[2000]; /* No novels to the error logs, OK? */
54  va_list ap;
55 
56  va_start(ap, msg);
57  vsprintf(buffer, msg, ap);
58  va_end(ap);
59 
60  G_fatal_error("%s", buffer);
61 }
62 
63 void Rast3d_fatal_error_noargs(const char *msg)
64 {
65  G_fatal_error("%s", msg);
66 }
67 
68 void Rast3d_error(const char *msg, ...)
69 {
70  char buffer[2000]; /* No novels to the error logs, OK? */
71  va_list ap;
72 
73  va_start(ap, msg);
74  vsprintf(buffer, msg, ap);
75  va_end(ap);
76 
77  (*g3d_error_fun)(buffer);
78 }
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Definition: gis.h:47
void Rast3d_fatal_error(const char *msg,...)
Prints fatal error message.
void Rast3d_fatal_error_noargs(const char *msg)
void Rast3d_skip_error(const char *msg UNUSED)
This function ignores the error.
void Rast3d_print_error(const char *msg)
Prints error message.
void Rast3d_error(const char *msg,...)