Debian Codegraph @

madrisan-nagios-plugins-linux/nagios-plugins-linux/include/common.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 /* common.h -- set of common macros and definitions
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
16
17 #ifndef _COMMON_H_
18 # define _COMMON_H_ 1
19
20 #define GPLv3_DISCLAIMER \
21 "\
22 License (SPDX ID): GPL-3.0-or-later \
23 <https://www.gnu.org/licenses/gpl.html>\n\
24 This is free software; you are free to change and redistribute it.\n\
25 There is NO WARRANTY, to the extent permitted by law.\n"
26
27 #define GETOPT_HELP_CHAR 'h'
28 #define GETOPT_VERSION_CHAR 'V'
29 #define GETOPT_HELP_VERSION_STRING "hV"
30
31 #define USAGE_HEADER "Usage:\n"
32 #define USAGE_OPTIONS "Options:\n"
33 #define USAGE_EXAMPLES "Examples:\n"
34 #define USAGE_NOTE "Note:\n"
35 #define USAGE_NOTE_1 "Note 1:\n"
36 #define USAGE_NOTE_2 "Note 2:\n"
37 #define USAGE_SEPARATOR "\n"
38 #define USAGE_HELP \
39 " -h, --help display this help and exit\n"
40 #define USAGE_VERSION \
41 " -V, --version output version information and exit\n"
42 #define USAGE_THRESHOLDS \
43 "\
44 See the Nagios Developer Guidelines for range format:\n\
45 <https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT>\n"
46
47 #define GETOPT_HELP_OPTION_DECL \
48 "help", no_argument, NULL, GETOPT_HELP_CHAR
49 #define GETOPT_VERSION_OPTION_DECL \
50 "version", no_argument, NULL, GETOPT_VERSION_CHAR
51
52 #define case_GETOPT_HELP_CHAR \
53 case GETOPT_HELP_CHAR: \
54 usage (stdout); \
55 break;
56
57 #define case_GETOPT_VERSION_CHAR \
58 case GETOPT_VERSION_CHAR: \
59 print_version (); \
60 printf (GPLv3_DISCLAIMER); \
61 exit (EXIT_SUCCESS); \
62 break;
63
64 /* One iteration with 1sec delay by default,
65 for plugins that support iterations */
66 #define DELAY_DEFAULT 1
67 #define COUNT_DEFAULT 2
68 #define DELAY_MAX 60
69 #define COUNT_MAX 100
70
71 /* Nagios Plugins error codes */
72
73 typedef enum nagstatus
74 {
75 STATE_OK,
76 STATE_WARNING,
77 STATE_CRITICAL,
78 STATE_UNKNOWN,
79 STATE_DEPENDENT
80 } nagstatus;
81
82 #endif /* _COMMON_H_ */