GRASS 8 Programmer's Manual  8.5.0dev(2025)-d272f2f102
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 void Rast3d_skip_error(const char *msg UNUSED)
20 {
21 }
22 
23 /*!
24  * \brief Prints error message
25  *
26  * This function prints the
27  * error message <em>msg</em> to <em>stderr</em> and returns.
28  *
29  * \param msg
30  * \return void
31  */
32 void Rast3d_print_error(const char *msg)
33 {
34  fprintf(stderr, "ERROR: ");
35  fprintf(stderr, "%s", msg);
36  fprintf(stderr, "\n");
37 }
38 
39 /*!
40  * \brief Prints fatal error message
41  *
42  * This function prints the fatal
43  * error message <em>msg</em>, and terminates the program with an error status.
44  *
45  * \param msg
46  * \return void
47  */
48 void Rast3d_fatal_error(const char *msg, ...)
49 {
50  char buffer[2000]; /* No novels to the error logs, OK? */
51  va_list ap;
52 
53  va_start(ap, msg);
54  vsprintf(buffer, msg, ap);
55  va_end(ap);
56 
57  G_fatal_error("%s", buffer);
58 }
59 
60 void Rast3d_fatal_error_noargs(const char *msg)
61 {
62  G_fatal_error("%s", msg);
63 }
64 
65 void Rast3d_error(const char *msg, ...)
66 {
67  char buffer[2000]; /* No novels to the error logs, OK? */
68  va_list ap;
69 
70  va_start(ap, msg);
71  vsprintf(buffer, msg, ap);
72  va_end(ap);
73 
74  (*g3d_error_fun)(buffer);
75 }
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:46
void Rast3d_fatal_error(const char *msg,...)
Prints fatal error message.
void Rast3d_fatal_error_noargs(const char *msg)
void Rast3d_print_error(const char *msg)
Prints error message.
void Rast3d_error(const char *msg,...)
void Rast3d_skip_error(const char *msg)
This function ignores the error.