GRASS 8 Programmer's Manual
8.5.0(2026)-8d6ceba290
Toggle main menu visibility
Loading...
Searching...
No Matches
datetime/error.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 1995. Bill Brown <brown@gis.uiuc.edu> & Michael Shapiro
3
*
4
* This program is free software under the GPL (>=v2)
5
* Read the file GPL.TXT coming with GRASS for details.
6
*/
7
#include <string.h>
8
9
static
int
err_code = 0;
10
static
char
err_msg[1024];
11
12
/*!
13
* \brief
14
*
15
* record 'code' and 'msg' as
16
* error code/msg (in static variables)
17
* code==0 will clear the error (ie set msg=NULL)
18
* returns 'code' so that it can be used like:
19
\code
20
return datetime_error (-1, "bad date");
21
\endcode
22
*
23
* \param code
24
* \param msg
25
* \return int
26
*/
27
int
datetime_error
(
int
code,
char
*msg)
28
{
29
err_code = code;
30
*err_msg = 0;
31
if
(code != 0 && msg)
32
strcpy
(err_msg, msg);
/* hope err_msg is big enough */
33
34
return
code;
35
}
36
37
/*!
38
* \brief
39
*
40
* returns an error code
41
*
42
* \return int
43
*/
44
int
datetime_error_code
(
void
)
45
{
46
return
err_code;
47
}
48
49
/*!
50
* \brief
51
*
52
* returns an error message
53
*
54
* \return char *
55
*/
56
char
*
datetime_error_msg
(
void
)
57
{
58
return
err_msg;
59
}
60
61
/*!
62
* \brief
63
*
64
* clears error code and message
65
*
66
* \return void
67
*/
68
void
datetime_clear_error
(
void
)
69
{
70
err_code = 0;
71
*err_msg = 0;
72
}
datetime_error
int datetime_error(int code, char *msg)
record 'code' and 'msg' as error code/msg (in static variables) code==0 will clear the error (ie set ...
Definition
datetime/error.c:27
datetime_error_code
int datetime_error_code(void)
returns an error code
Definition
datetime/error.c:44
datetime_error_msg
char * datetime_error_msg(void)
returns an error message
Definition
datetime/error.c:56
datetime_clear_error
void datetime_clear_error(void)
clears error code and message
Definition
datetime/error.c:68
strcpy
#define strcpy
Definition
parson.c:66
datetime
error.c
Generated on
for GRASS 8 Programmer's Manual by
1.17.0