STASIS
A pipeline delivery generator
Loading...
Searching...
No Matches
envctl.h
Go to the documentation of this file.
1
2#ifndef STASIS_ENVCTL_H
3#define STASIS_ENVCTL_H
4
5#include <stdlib.h>
6#include "core.h"
7
8#define STASIS_ENVCTL_PASSTHRU 0
9#define STASIS_ENVCTL_REQUIRED 1 << 1
10#define STASIS_ENVCTL_REDACT 1 << 2
11#define STASIS_ENVCTL_DEFAULT_ALLOC 100
12
13#define STASIS_ENVCTL_RET_FAIL (-1)
14#define STASIS_ENVCTL_RET_SUCCESS 1
15#define STASIS_ENVCTL_RET_IGNORE 2
16typedef int (envctl_except_fn)(const void *, const void *);
17
19 unsigned flags; //<! One or more STASIS_ENVCTL_* flags
20 const char *name; //<! Environment variable name
21 envctl_except_fn *callback;
22};
23
24struct EnvCtl {
25 size_t num_alloc;
26 size_t num_used;
27 struct EnvCtl_Item **item;
28};
29
30struct EnvCtl *envctl_init();
31int envctl_register(struct EnvCtl **envctl, unsigned flags, envctl_except_fn *callback, const char *name);
32unsigned envctl_get_flags(const struct EnvCtl *envctl, const char *name);
33unsigned envctl_check_required(unsigned flags);
34unsigned envctl_check_redact(unsigned flags);
35int envctl_check_present(const struct EnvCtl_Item *item, const char *name);
36void envctl_do_required(const struct EnvCtl *envctl, int verbose);
37void envctl_free(struct EnvCtl **envctl);
38
39#endif // STASIS_ENVCTL_H
Definition envctl.h:18
Definition envctl.h:24