rsstats 0.0.1
Redis Enterprise Statistic collector
rsstats-opts.h
Go to the documentation of this file.
1/* -*- buffer-read-only: t -*- vi: set ro:
2 *
3 * DO NOT EDIT THIS FILE (rsstats-opts.h)
4 *
5 * It has been AutoGen-ed
6 * From the definitions rsstats-opts.def
7 * and the template file options
8 *
9 * Generated from AutoOpts 42:1:17 templates.
10 *
11 * AutoOpts is a copyrighted work. This header file is not encumbered
12 * by AutoOpts licensing, but is provided under the licensing terms chosen
13 * by the rsstats author or copyright holder. AutoOpts is
14 * licensed under the terms of the LGPL. The redistributable library
15 * (``libopts'') is licensed under the terms of either the LGPL or, at the
16 * users discretion, the BSD license. See the AutoOpts and/or libopts sources
17 * for details.
18 *
19 * The rsstats program is copyrighted and licensed
20 * under the following terms:
21 *
22 * Copyright (C) 2024 Francois Cerbelle, all rights reserved.
23 * This is free software. It is licensed for use, modification and
24 * redistribution under the terms of the GNU General Public License,
25 * version 3 or later <http://gnu.org/licenses/gpl.html>
26 *
27 * rsstats is free software: you can redistribute it and/or modify it
28 * under the terms of the GNU General Public License as published by the
29 * Free Software Foundation, either version 3 of the License, or
30 * (at your option) any later version.
31 *
32 * rsstats is distributed in the hope that it will be useful, but
33 * WITHOUT ANY WARRANTY; without even the implied warranty of
34 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
35 * See the GNU General Public License for more details.
36 *
37 * You should have received a copy of the GNU General Public License along
38 * with this program. If not, see <http://www.gnu.org/licenses/>.
39 */
46#ifndef AUTOOPTS_RSSTATS_OPTS_H_GUARD
47#define AUTOOPTS_RSSTATS_OPTS_H_GUARD 1
48#include "config.h"
49#include <autoopts/options.h>
50#include <stdarg.h>
51#include <stdnoreturn.h>
52
60#define AO_TEMPLATE_VERSION 172033
61#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
62 || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
63# error option template version mismatches autoopts/options.h header
64 Choke Me.
65#endif
66
67#if GCC_VERSION > 40400
68#define NOT_REACHED __builtin_unreachable();
69#else
70#define NOT_REACHED
71#endif
72
76typedef enum {
88#define OPTION_CT 9
90#define RSSTATS_VERSION "0.0.1"
92#define RSSTATS_FULL_VERSION "rsstats 0.0.1"
93
99#define DESC(n) (rsstatsOptions.pOptDesc[INDEX_OPT_## n])
101#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
103#define OPT_ARG(n) (DESC(n).optArg.argString)
108#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
110#define COUNT_OPT(n) (DESC(n).optOccCt)
112#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
114#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
116#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
119#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
122#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
124#define CLEAR_OPT(n) STMTS( \
125 DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \
126 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
127 DESC(n).fOptState |= OPTST_DISABLED; \
128 DESC(n).optCookie = NULL )
129/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
133typedef enum {
144#define VALUE_OPT_INPUT 'i'
145#define VALUE_OPT_OUTPUT 'o'
146#define VALUE_OPT_CLUSTERS 'c'
147#define VALUE_OPT_REPORTS 'r'
148
149#define REPORTS_SAMPLE 0x1UL
150#define REPORTS_BDBS 0x2UL
151#define REPORTS_CLUSTER 0x4UL
152#define REPORTS_MEMBERSHIP_MASK 0x7UL
153#define OPT_VALUE_REPORTS ((uintptr_t)DESC(REPORTS).optCookie)
154#define OPT_MEMLST_REPORTS optionMemberList(&DESC(REPORTS))
156#define VALUE_OPT_HELP 'h'
158#define VALUE_OPT_MORE_HELP 'H'
160#define VALUE_OPT_VERSION 'v'
162#define VALUE_OPT_SAVE_OPTS '>'
164#define VALUE_OPT_LOAD_OPTS '<'
165#define SET_OPT_SAVE_OPTS(a) STMTS( \
166 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
167 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
168 DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
169/*
170 * Interface defines not associated with particular options
171 */
172#define ERRSKIP_OPTERR STMTS(rsstatsOptions.fOptSet &= ~OPTPROC_ERRSTOP)
173#define ERRSTOP_OPTERR STMTS(rsstatsOptions.fOptSet |= OPTPROC_ERRSTOP)
174#define RESTART_OPT(n) STMTS( \
175 rsstatsOptions.curOptIdx = (n); \
176 rsstatsOptions.pzCurOpt = NULL )
177#define START_OPT RESTART_OPT(1)
178#define USAGE(c) (*rsstatsOptions.pUsageProc)(&rsstatsOptions, c)
179
180#ifdef __cplusplus
181extern "C" {
182#endif
183
184
185/* * * * * *
186 *
187 * Declare the rsstats option descriptor.
188 */
189extern tOptions rsstatsOptions;
190
191#if defined(ENABLE_NLS)
192# ifndef _
193# include <stdio.h>
194# ifndef HAVE_GETTEXT
195 extern char * gettext(char const *);
196# else
197# include <libintl.h>
198# endif
199
200# ifndef ATTRIBUTE_FORMAT_ARG
201# define ATTRIBUTE_FORMAT_ARG(_a)
202# endif
203
204static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
205static inline char* aoGetsText(char const* pz) {
206 if (pz == NULL) return NULL;
207 return (char*)gettext(pz);
208}
209# define _(s) aoGetsText(s)
210# endif /* _() */
211
212# define OPT_NO_XLAT_CFG_NAMES STMTS(rsstatsOptions.fOptSet |= \
213 OPTPROC_NXLAT_OPT_CFG;)
214# define OPT_NO_XLAT_OPT_NAMES STMTS(rsstatsOptions.fOptSet |= \
215 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
216
217# define OPT_XLAT_CFG_NAMES STMTS(rsstatsOptions.fOptSet &= \
218 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
219# define OPT_XLAT_OPT_NAMES STMTS(rsstatsOptions.fOptSet &= \
220 ~OPTPROC_NXLAT_OPT;)
221
222#else /* ENABLE_NLS */
223# define OPT_NO_XLAT_CFG_NAMES
224# define OPT_NO_XLAT_OPT_NAMES
225
226# define OPT_XLAT_CFG_NAMES
227# define OPT_XLAT_OPT_NAMES
228
229# ifndef _
230# define _(_s) _s
231# endif
232#endif /* ENABLE_NLS */
233
234
235#ifdef __cplusplus
236}
237#endif
238#endif /* AUTOOPTS_RSSTATS_OPTS_H_GUARD */
239
240/* rsstats-opts.h ends here */
#define NULL
Definition: rsstats-opts.c:64
rsstats_exit_code_t
Enumeration of rsstats exit codes.
Definition: rsstats-opts.h:133
@ RSSTATS_EXIT_NO_CONFIG_INPUT
Definition: rsstats-opts.h:137
@ RSSTATS_EXIT_FAILURE
Definition: rsstats-opts.h:135
@ RSSTATS_EXIT_LIBOPTS_FAILURE
Definition: rsstats-opts.h:138
@ RSSTATS_EXIT_SUCCESS
Definition: rsstats-opts.h:134
@ RSSTATS_EXIT_USAGE_ERROR
Definition: rsstats-opts.h:136
tOptions rsstatsOptions
The option definitions for rsstats.
Definition: rsstats-opts.c:533
teOptIndex
Enumeration of each option type for rsstats.
Definition: rsstats-opts.h:76
@ INDEX_OPT_HELP
Definition: rsstats-opts.h:82
@ INDEX_OPT_OUTPUT
Definition: rsstats-opts.h:78
@ INDEX_OPT_CLUSTERS
Definition: rsstats-opts.h:79
@ INDEX_OPT_VERSION
Definition: rsstats-opts.h:81
@ INDEX_OPT_MORE_HELP
Definition: rsstats-opts.h:83
@ INDEX_OPT_INPUT
Definition: rsstats-opts.h:77
@ INDEX_OPT_LOAD_OPTS
Definition: rsstats-opts.h:85
@ INDEX_OPT_REPORTS
Definition: rsstats-opts.h:80
@ INDEX_OPT_SAVE_OPTS
Definition: rsstats-opts.h:84