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_BDBS 0x1UL
150#define REPORTS_CLUSTER 0x2UL
151#define REPORTS_MEMBERSHIP_MASK 0x3UL
152#define OPT_VALUE_REPORTS ((uintptr_t)DESC(REPORTS).optCookie)
153#define OPT_MEMLST_REPORTS optionMemberList(&DESC(REPORTS))
155#define VALUE_OPT_HELP 'h'
157#define VALUE_OPT_MORE_HELP 'H'
159#define VALUE_OPT_VERSION 'v'
161#define VALUE_OPT_SAVE_OPTS '>'
163#define VALUE_OPT_LOAD_OPTS '<'
164#define SET_OPT_SAVE_OPTS(a) STMTS( \
165 DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
166 DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
167 DESC(SAVE_OPTS).optArg.argString = (char const*)(a))
168/*
169 * Interface defines not associated with particular options
170 */
171#define ERRSKIP_OPTERR STMTS(rsstatsOptions.fOptSet &= ~OPTPROC_ERRSTOP)
172#define ERRSTOP_OPTERR STMTS(rsstatsOptions.fOptSet |= OPTPROC_ERRSTOP)
173#define RESTART_OPT(n) STMTS( \
174 rsstatsOptions.curOptIdx = (n); \
175 rsstatsOptions.pzCurOpt = NULL )
176#define START_OPT RESTART_OPT(1)
177#define USAGE(c) (*rsstatsOptions.pUsageProc)(&rsstatsOptions, c)
178
179#ifdef __cplusplus
180extern "C" {
181#endif
182
183
184/* * * * * *
185 *
186 * Declare the rsstats option descriptor.
187 */
188extern tOptions rsstatsOptions;
189
190#if defined(ENABLE_NLS)
191# ifndef _
192# include <stdio.h>
193# ifndef HAVE_GETTEXT
194 extern char * gettext(char const *);
195# else
196# include <libintl.h>
197# endif
198
199# ifndef ATTRIBUTE_FORMAT_ARG
200# define ATTRIBUTE_FORMAT_ARG(_a)
201# endif
202
203static inline char* aoGetsText(char const* pz) ATTRIBUTE_FORMAT_ARG(1);
204static inline char* aoGetsText(char const* pz) {
205 if (pz == NULL) return NULL;
206 return (char*)gettext(pz);
207}
208# define _(s) aoGetsText(s)
209# endif /* _() */
210
211# define OPT_NO_XLAT_CFG_NAMES STMTS(rsstatsOptions.fOptSet |= \
212 OPTPROC_NXLAT_OPT_CFG;)
213# define OPT_NO_XLAT_OPT_NAMES STMTS(rsstatsOptions.fOptSet |= \
214 OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
215
216# define OPT_XLAT_CFG_NAMES STMTS(rsstatsOptions.fOptSet &= \
217 ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
218# define OPT_XLAT_OPT_NAMES STMTS(rsstatsOptions.fOptSet &= \
219 ~OPTPROC_NXLAT_OPT;)
220
221#else /* ENABLE_NLS */
222# define OPT_NO_XLAT_CFG_NAMES
223# define OPT_NO_XLAT_OPT_NAMES
224
225# define OPT_XLAT_CFG_NAMES
226# define OPT_XLAT_OPT_NAMES
227
228# ifndef _
229# define _(_s) _s
230# endif
231#endif /* ENABLE_NLS */
232
233
234#ifdef __cplusplus
235}
236#endif
237#endif /* AUTOOPTS_RSSTATS_OPTS_H_GUARD */
238
239/* 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:508
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