Debian Codegraph @

src/oidc-gen/promptAndSet/_helper.h

raw
1 #ifndef OIDC_PROMPTANDSET_HELPER_H
2 #define OIDC_PROMPTANDSET_HELPER_H
3
4 #include <stdlib.h>
5
6 #include "utils/printer.h"
7 #include "utils/prompt_mode.h"
8
9 #ifndef ERROR_MESSAGE
10 #define ERROR_MESSAGE(_name, _option) \
11 "Required argument " _name \
12 " not given. Please enable a prompt mode or pass " _name \
13 " to the '--" _option "' option."
14 #endif
15
16 #ifndef ERROR_IF_NO_PROMPT
17 #define ERROR_IF_NO_PROMPT(_optional, _error_message) \
18 do { \
19 if (prompt_mode() == 0) { \
20 if ((_optional)) { \
21 return; \
22 } \
23 printError("%s\n", (_error_message)); \
24 exit(EXIT_FAILURE); \
25 } \
26 } while (0)
27 #endif
28
29 char* _gen_prompt(char* label, const char* init, int passPrompt, int optional);
30 char* _gen_promptMultipleSpaceSeparated(char* label, const char* init_str,
31 int optional);
32
33 #endif // OIDC_PROMPTANDSET_HELPER_H