ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
presets.h File Reference

Preset option configurations for ascii-chat modes. More...

Go to the source code of this file.

Functions

options_config_t * options_preset_unified (const char *program_name, const char *description)
 Build unified options config with ALL options (binary + all modes)
 

Detailed Description

Preset option configurations for ascii-chat modes.

Definition in file presets.h.

Function Documentation

◆ options_preset_unified()

options_config_t * options_preset_unified ( const char *  program_name,
const char *  description 
)

Build unified options config with ALL options (binary + all modes)

This is the single source of truth for all options. Each option has a mode_bitmask indicating which modes it applies to. The config includes all options, and validation happens after parsing based on detected mode.

Get binary-level options preset.

This is the single source of truth for all options. Each option has a mode_bitmask indicating which modes it applies to. The config includes all options, and validation happens after parsing based on detected mode.

Definition at line 51 of file presets.c.

51 {
53 if (!b) {
54 SET_ERRNO(ERROR_MEMORY, "Failed to create options builder");
55 return NULL;
56 }
57
58 b->program_name = program_name ? program_name : "ascii-chat";
59 b->description = description ? description : "Video chat in your terminal";
60
61 // Add ALL options from registry (binary + all modes)
63 if (err != ASCIICHAT_OK) {
65 SET_ERRNO(err, "Failed to add all options to builder");
66 return NULL;
67 }
68
69 // Add positional arguments for each mode
70 // These allow parsing of positional arguments like "192.168.1.1" for client mode
71 // and "[bind-address]" for server mode
72
73 // Generate random session strings for examples
74 // Use static buffers so they persist after the function returns
75 static char session_buf1[SESSION_STRING_BUFFER_SIZE];
76 static char session_buf2[SESSION_STRING_BUFFER_SIZE];
77 static char session_buf3[SESSION_STRING_BUFFER_SIZE];
78 static char session_buf4[SESSION_STRING_BUFFER_SIZE];
79 static char session_buf5[SESSION_STRING_BUFFER_SIZE];
80 static char session_buf6[SESSION_STRING_BUFFER_SIZE];
81 static char session_buf7[SESSION_STRING_BUFFER_SIZE];
82 static char session_buf8[SESSION_STRING_BUFFER_SIZE];
83 static char session_buf9[SESSION_STRING_BUFFER_SIZE];
84 static char session_buf10[SESSION_STRING_BUFFER_SIZE];
85
86 // Fallback strings if generation fails
87 char *example_session_string1 = "adjective-noun-noun";
88 char *example_session_string2 = "adjective-noun-noun";
89 char *example_session_string3 = "adjective-noun-noun";
90 char *example_session_string4 = "adjective-noun-noun";
91 char *example_session_string5 = "adjective-noun-noun";
92 char *example_session_string6 = "adjective-noun-noun";
93 char *example_session_string7 = "adjective-noun-noun";
94 char *example_session_string8 = "adjective-noun-noun";
95 char *example_session_string9 = "adjective-noun-noun";
96 char *example_session_string10 = "adjective-noun-noun";
97
98 // Generate session strings for examples (sodium_init called as needed by acds_string_generate)
99 acds_string_generate(session_buf1, sizeof(session_buf1));
100 if (session_buf1[0] != '\0') {
101 example_session_string1 = session_buf1;
102 }
103 acds_string_generate(session_buf2, sizeof(session_buf2));
104 if (session_buf2[0] != '\0') {
105 example_session_string2 = session_buf2;
106 }
107 acds_string_generate(session_buf3, sizeof(session_buf3));
108 if (session_buf3[0] != '\0') {
109 example_session_string3 = session_buf3;
110 }
111 acds_string_generate(session_buf4, sizeof(session_buf4));
112 if (session_buf4[0] != '\0') {
113 example_session_string4 = session_buf4;
114 }
115 acds_string_generate(session_buf5, sizeof(session_buf5));
116 if (session_buf5[0] != '\0') {
117 example_session_string5 = session_buf5;
118 }
119 acds_string_generate(session_buf6, sizeof(session_buf6));
120 if (session_buf6[0] != '\0') {
121 example_session_string6 = session_buf6;
122 }
123 acds_string_generate(session_buf7, sizeof(session_buf7));
124 if (session_buf7[0] != '\0') {
125 example_session_string7 = session_buf7;
126 }
127 acds_string_generate(session_buf8, sizeof(session_buf8));
128 if (session_buf8[0] != '\0') {
129 example_session_string8 = session_buf8;
130 }
131 acds_string_generate(session_buf9, sizeof(session_buf9));
132 if (session_buf9[0] != '\0') {
133 example_session_string9 = session_buf9;
134 }
135 acds_string_generate(session_buf10, sizeof(session_buf10));
136 if (session_buf10[0] != '\0') {
137 example_session_string10 = session_buf10;
138 }
139
140 // Build session string examples dynamically for discovery mode
141 // These appear at the beginning of the examples section, right after "start new session"
142 static char example_buf1[SESSION_STRING_BUFFER_SIZE];
143 static char example_buf2[SESSION_STRING_BUFFER_SIZE];
144 static char example_buf3[SESSION_STRING_BUFFER_SIZE];
145 static char example_buf4[SESSION_STRING_BUFFER_SIZE];
146 static char example_buf5[SESSION_STRING_BUFFER_SIZE];
147 static char example_buf6[SESSION_STRING_BUFFER_SIZE];
148 static char example_buf7[SESSION_STRING_BUFFER_SIZE];
149 static char example_buf8[SESSION_STRING_BUFFER_SIZE];
150 static char example_buf9[SESSION_STRING_BUFFER_SIZE];
151 static char example_buf10[SESSION_STRING_BUFFER_SIZE];
152
153 safe_snprintf(example_buf1, sizeof(example_buf1), "%s", example_session_string1);
154 safe_snprintf(example_buf2, sizeof(example_buf2), "%s", example_session_string2);
155 safe_snprintf(example_buf3, sizeof(example_buf3), "%s", example_session_string3);
156 safe_snprintf(example_buf4, sizeof(example_buf4), "%s", example_session_string4);
157 safe_snprintf(example_buf5, sizeof(example_buf5), "%s", example_session_string5);
158 safe_snprintf(example_buf6, sizeof(example_buf6), "%s", example_session_string6);
159 safe_snprintf(example_buf7, sizeof(example_buf7), "%s", example_session_string7);
160 safe_snprintf(example_buf8, sizeof(example_buf8), "%s", example_session_string8);
161 safe_snprintf(example_buf9, sizeof(example_buf9), "%s", example_session_string9);
162 safe_snprintf(example_buf10, sizeof(example_buf10), "%s", example_session_string10);
163
164 // Client mode: [address] - can be IP, hostname, hostname:port, or WebSocket URL
165 static const char *client_examples[] = {"localhost",
166 "ascii-chat.com",
167 "0.0.0.0",
168 "::",
169 "192.168.1.1:8080",
170 "[2001:db8::42]:27224",
171 "233.27.48.203:27224",
172 "62fb:759e:2bce:21d7:9e5d:13f8:3c11:5084:27224",
173 "ws://example.com:8080",
174 "wss://secure.example.com:443"};
175 // Discovery mode: [session-string] - session string or empty to start new session
176 // Use simple static examples for positional arguments section (dynamic strings shown in examples section)
177 static const char *discovery_examples[] = {
178 "(empty/unset) start new session. generates a session string to give someone to connect to you.",
179 (const char *)example_buf7, (const char *)example_buf8, (const char *)example_buf9, (const char *)example_buf10};
181 b, "session-string", "(optional) Random three words in format adjective-noun-noun that connect you to a call.",
182 false, "POSITIONAL ARGUMENTS", discovery_examples, ARRAY_SIZE(discovery_examples), OPTION_MODE_DISCOVERY,
184
185 // Server and Discovery Service modes: [bind-address] [bind-address] - can be IP or hostname, up to 2 for IPv4/IPv6
186 static const char *server_examples[] = {"localhost",
187 "ascii-chat.com",
188 "0.0.0.0",
189 "::",
190 "234.50.188.236",
191 "9631:54e7:5b5c:80dc:0f62:1f01:7ccf:5512",
192 "105.137.19.11 3a08:7276:ccb4:7b31:e934:5330:9b3a:9598",
193 "::1 192.168.1.100"};
194 options_builder_add_positional(b, "bind-address",
195 "(optional) 0-2 addresses for a server to bind to, one IPv4 and the other IPv6.",
196 false, "POSITIONAL ARGUMENTS", server_examples, ARRAY_SIZE(server_examples),
198
199 options_builder_add_positional(b, "address", "(optional) Server address for client to connect to.", false,
200 "POSITIONAL ARGUMENTS", client_examples, ARRAY_SIZE(client_examples),
202
203 // Mirror mode: [file|url] - file path or URL to stream
204 static const char *mirror_media_examples[] = {"/path/to/video.mp4", "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
205 "https://example.com/stream.m3u8"};
206 options_builder_add_positional(b, "file|url",
207 "(optional) Media file path or URL to stream. If omitted, uses webcam. "
208 "Cannot be combined with --file or --url.",
209 false, "POSITIONAL ARGUMENTS", mirror_media_examples,
210 ARRAY_SIZE(mirror_media_examples), OPTION_MODE_MIRROR, parse_mirror_media);
211
212 // Add usage lines for all modes
213 options_builder_add_usage(b, NULL, NULL, true, "Start a new session (share the session string)");
214 options_builder_add_usage(b, NULL, "<session-string>", true, "Join an existing session");
215 options_builder_add_usage(b, NULL, "<mode>", true, "Run in a specific mode");
216 options_builder_add_usage(b, "server", "[bind-address] [bind-address]", true,
217 "Start server (can specify 0-2 bind addresses, one IPv4 and the other IPv6)");
218 options_builder_add_usage(b, "client", "[address]", true, "Connect to server (defaults to localhost:27224)");
219 options_builder_add_usage(b, "mirror", "[file|url]", true, "View local webcam or media file or URL as ASCII art");
220 options_builder_add_usage(b, "discovery-service", "[bind-address] [bind-address]", true,
221 "Start discovery service (can specify 0-2 bind addresses, one IPv4 and the other IPv6)");
222 options_builder_add_usage(b, NULL, "[mode] --help", false, "Show help for a specific mode");
223
224 // Add examples for binary-level help and discovery mode
225 options_builder_add_example(b, OPTION_MODE_BINARY, NULL, "Start new session (share the session string)", false);
226 options_builder_add_example(b, OPTION_MODE_BINARY, example_buf1, "Join a session using the session string", true);
227
228 // Build combined examples with session string + flags
229 static char combined_buf1[256];
230 static char combined_buf2[256];
231 static char combined_buf3[256];
232 static char combined_buf4[256];
233 static char combined_buf5[256];
234 safe_snprintf(combined_buf1, sizeof(combined_buf1), "%s --file video.mp4", example_buf3);
235 safe_snprintf(combined_buf2, sizeof(combined_buf2), "%s --url 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'",
236 example_buf4);
237 safe_snprintf(combined_buf3, sizeof(combined_buf3), "%s -f -", example_buf5);
238 safe_snprintf(combined_buf4, sizeof(combined_buf4), "%s --palette-chars '@%%#*+=-:. '", example_buf6);
239 safe_snprintf(combined_buf5, sizeof(combined_buf5), "%s --discovery-service --discovery-service-port 27225",
240 example_buf2);
241
242 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf1, "Join session and stream from local video file",
243 false);
244 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf2, "Join session and stream from YouTube video",
245 false);
246 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf3, "Join session and stream media from stdin", false);
247 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf4, "Join session with custom ASCII palette characters",
248 false);
249 options_builder_add_example(b, OPTION_MODE_BINARY, combined_buf5, "Join session via custom discovery server", false);
250
251 // Add examples for server-like modes (server + discovery-service)
252 options_builder_add_example(b, OPTION_MODE_SERVER_LIKE, NULL, "Start on localhost (127.0.0.1 and ::1)", false);
253 options_builder_add_example(b, OPTION_MODE_SERVER_LIKE, "0.0.0.0", "Start on all IPv4 interfaces", false);
255 "0.0.0.0 ::", "Start on all IPv4 and IPv6 interfaces (dual-stack)", false);
256 options_builder_add_example(b, OPTION_MODE_SERVER_LIKE, "--port 8080", "Start on custom port", false);
257
258 // Server-specific examples
259 options_builder_add_example(b, OPTION_MODE_SERVER, "--key ~/.ssh/id_ed25519 --discovery",
260 "Start with identity key and discovery registration", false);
261
262 // Add examples for client-like modes (client + mirror)
263 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--url 'https://youtu.be/7ynHVGCehoM'",
264 "Stream from YouTube URL (also supports RTSP, HTTP, and HTTPS URLs)", false);
265 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--url 'https://www.twitch.tv/ludwig'",
266 "Stream Ludwig from videogames on Twitch", false);
267 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "-f video.mp4", "Stream from local video file", false);
268 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--palette-chars '@%#*+=-:. '",
269 "Custom palette characters to use. UTF-8 is allowed.", false);
271 b, OPTION_MODE_CLIENT_LIKE, "--snapshot",
272 "Print ascii art for --snapshot-delay's value of seconds then print the last frame and exit. "
273 "In snapshot mode, --width, --height, and --color are NOT autodetected when piping stdin in or redirecting "
274 "output.",
275 false);
276 options_builder_add_example(b, OPTION_MODE_CLIENT_LIKE, "--color-filter cyan --palette cool",
277 "Apply cyan color filter and cool palette", false);
278
279 // Client-specific examples
280 options_builder_add_example(b, OPTION_MODE_CLIENT, "example.com", "Connect to remote server", false);
281 options_builder_add_example(b, OPTION_MODE_CLIENT, "example.com:8080", "Connect to remote server on custom port",
282 false);
283 options_builder_add_example(b, OPTION_MODE_CLIENT, "--color-mode mono --render-mode half-block --width 120",
284 "Connect with custom display options", false);
285
286 // Mirror-specific examples (unique to mirror mode)
288 b, OPTION_MODE_MIRROR, NULL,
289 "View the webcam or files or URLs as ASCII art. Like client mode but without network connectivity or a server.",
290 false);
291 options_builder_add_example(b, OPTION_MODE_MIRROR, "--color-mode mono", "View webcam in black and white", false);
292 options_builder_add_example(b, OPTION_MODE_MIRROR, "--color-filter green",
293 "View webcam with green monochromatic color filter", false);
294 options_builder_add_example(b, OPTION_MODE_MIRROR, "--matrix --color-filter rainbow",
295 "Matrix rain effect with rainbow colors cycling over 3.5s", false);
297 "Stream media from stdin (cat file.gif | ascii-chat mirror -f '-')", false);
298 options_builder_add_example_utility(b, OPTION_MODE_MIRROR, "cat video.avi | ascii-chat mirror -f '-' -l -s 00:30",
299 "Stream .avi from stdin, looped, seeking to 00:30", true);
300 options_builder_add_example(b, OPTION_MODE_MIRROR, "--file video.mov --seek 22:10",
301 "Start playback at exactly 22:10 (also works with --url)", false);
302 options_builder_add_example(b, OPTION_MODE_MIRROR, "-f 'https://youtu.be/LS9W8SO-Two' -S -D 0 -s 5:12",
303 "Print a single frame from a YouTube video at exactly 5:12 and exit", false);
304 options_builder_add_example(b, OPTION_MODE_MIRROR, "-S -D 0 | tee frame.txt | pbcopy",
305 "Capture single ASCII frame to clipboard (macOS) and file", false);
307 "View ASCII frame from clipboard (macOS)", true);
308
309 // Discovery-service specific examples
310 options_builder_add_example(b, OPTION_MODE_DISCOVERY_SVC, "--require-server-identity --require-client-identity",
311 "Enforce identity verification for all parties", false);
312
313 // Add mode descriptions
315 b, "default",
316 "When the ascii-chat binary is used without a mode, it operates as either client or server automatically and "
317 "uses the discovery-service to make peer connections with session strings");
318 options_builder_add_mode(b, "server", "Run as multi-client video chat server");
319 options_builder_add_mode(b, "client", "Run as video chat client (connect to server)");
320 options_builder_add_mode(b, "mirror", "View local media as ASCII art (no server)");
321 options_builder_add_mode(b, "discovery-service", "Secure P2P session signalling");
322
323 // Add custom help sections for interactive modes (client, mirror, and discovery)
324 options_builder_add_custom_section(b, "KEYBINDINGS",
325 "Available in ascii-chat client, mirror, and discovery modes. "
326 "While rendering, press '?' to display a keyboard shortcuts help menu showing:\n"
327 " - Available keybindings (?, Space, arrows, m, c, f, r)\n"
328 " - Current settings (volume, color mode, audio status, etc.)",
330
331 // Add environment variables section (all modes)
333 b, "ENVIRONMENT",
334 "All command-line flags that accept values have corresponding environment variables.\n"
335 " Format: ASCII_CHAT_<FLAG_NAME> where FLAG_NAME is uppercase with hyphens replaced by underscores\n"
336 " Example: --color-filter maps to ASCII_CHAT_COLOR_FILTER\n"
337 "\n"
338 " Configuration precedence (lowest to highest):\n"
339 " 1. Config file values (~/.ascii-chat/config.toml)\n"
340 " 2. Environment variables (ASCII_CHAT_*)\n"
341 " 3. Command-line flags (--flag-name)\n"
342 "\n"
343 " Additional environment variables are documented in the ascii-chat(1) man page.",
345
346 // Add common dependencies (these will be validated after parsing)
347 // Note: Dependencies are validated at runtime, so we add them here for documentation
348
349 // ============================================================================
350 // Media Source Conflicts
351 // ============================================================================
352 // URL conflicts: --url cannot be used with --file or --loop
354 "Option --url cannot be used with --file (--url takes priority)");
356 b, "url", "loop", "Option --url cannot be used with --loop (network streams cannot be looped)");
357
358 // ============================================================================
359 // Encryption & Authentication Conflicts
360 // ============================================================================
361 // Cannot use both --encrypt and --no-encrypt
362 options_builder_add_dependency_conflicts(b, "no-encrypt", "encrypt", "Cannot use --no-encrypt with --encrypt");
363 options_builder_add_dependency_conflicts(b, "no-encrypt", "key",
364 "Cannot use --no-encrypt with --key (key requires encryption)");
365 options_builder_add_dependency_conflicts(b, "no-encrypt", "password",
366 "Cannot use --no-encrypt with --password (password requires encryption)");
368 b, "no-encrypt", "client-keys",
369 "Cannot use --no-encrypt with --client-keys (key validation requires encryption)");
371 b, "no-encrypt", "server-key", "Cannot use --no-encrypt with --server-key (key validation requires encryption)");
372
373 // Cannot use --no-auth with authentication material (--key, --password, --client-keys, --server-key)
375 "Cannot use --no-auth with --key (key requires authentication)");
376 options_builder_add_dependency_conflicts(b, "no-auth", "password",
377 "Cannot use --no-auth with --password (password requires authentication)");
379 b, "no-auth", "client-keys", "Cannot use --no-auth with --client-keys (key list requires authentication)");
381 b, "no-auth", "server-key", "Cannot use --no-auth with --server-key (verification requires authentication)");
382
383 // Cannot use --key with --server-key (both server-side key options)
385 b, "key", "server-key",
386 "Cannot use --key with --server-key (--key is server identity, --server-key is client-side)");
387
388 // ============================================================================
389 // Compression Conflicts
390 // ============================================================================
391 // Cannot use --no-compress with --compression-level
392 options_builder_add_dependency_conflicts(b, "no-compress", "compression-level",
393 "Cannot use --no-compress with --compression-level");
394
395 // ============================================================================
396 // Audio Encoding Conflicts
397 // ============================================================================
398 // Cannot use both --encode-audio and --no-encode-audio
399 options_builder_add_dependency_conflicts(b, "encode-audio", "no-encode-audio",
400 "Cannot use both --encode-audio and --no-encode-audio");
401
402 // ============================================================================
403 // Display & Screen Conflicts
404 // ============================================================================
405 options_builder_add_dependency_conflicts(b, "waveform", "matrix",
406 "Option --waveform cannot be used with --matrix");
407 options_builder_add_dependency_conflicts(b, "fft", "matrix", "Option --fft cannot be used with --matrix");
408 options_builder_add_dependency_conflicts(b, "waveform", "fft",
409 "Options --waveform and --fft cannot be used together");
410 options_builder_add_dependency_conflicts(b, "waveform", "audio",
411 "Option --waveform requires audio; remove --audio=false");
412 options_builder_add_dependency_conflicts(b, "fft", "audio", "Option --fft requires audio; remove --audio=false");
413 options_builder_add_dependency_conflicts(b, "waveform", "stretch",
414 "Option --waveform cannot be used with --stretch");
415 options_builder_add_dependency_conflicts(b, "fft", "stretch", "Option --fft cannot be used with --stretch");
416
417 // ============================================================================
418 // Requirements (dependencies that must be satisfied)
419 // ============================================================================
420 // --snapshot-delay requires --snapshot
421 options_builder_add_dependency_requires(b, "snapshot-delay", "snapshot",
422 "Option --snapshot-delay requires --snapshot");
423
424 // --loop requires --file (can't loop network streams)
425 options_builder_add_dependency_requires(b, "loop", "file", "Option --loop requires --file");
426
427 const options_config_t *config = options_builder_build(b);
429 return config;
430}
void options_builder_add_usage(options_builder_t *builder, const char *mode, const char *positional, bool show_options, const char *description)
Add usage line descriptor.
Definition builder.c:1242
void options_builder_add_example(options_builder_t *builder, uint32_t mode_bitmask, const char *args, const char *description, bool owns_args)
Add example descriptor.
Definition builder.c:1255
void options_builder_add_dependency_requires(options_builder_t *builder, const char *option_name, const char *depends_on, const char *error_message)
Add dependency: if option_name is set, depends_on must be set.
Definition builder.c:1130
void options_builder_add_positional(options_builder_t *builder, const char *name, const char *help_text, bool required, const char *section_heading, const char **examples, size_t num_examples, option_mode_bitmask_t mode_bitmask, int(*parse_fn)(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg))
Add positional argument descriptor.
Definition builder.c:1192
void options_builder_add_dependency_conflicts(options_builder_t *builder, const char *option_name, const char *conflicts_with, const char *error_message)
Add anti-dependency: if option_name is set, conflicts_with must NOT be set.
Definition builder.c:1142
void options_builder_add_mode(options_builder_t *builder, const char *name, const char *description)
Add mode descriptor.
Definition builder.c:1308
void options_builder_add_custom_section(options_builder_t *builder, const char *heading, const char *content, option_mode_bitmask_t mode_bitmask)
Add a custom help section.
Definition builder.c:1319
void options_builder_destroy(options_builder_t *builder)
Free options builder.
Definition builder.c:467
options_config_t * options_builder_build(options_builder_t *builder)
Build immutable options config.
Definition builder.c:482
void options_builder_add_example_utility(options_builder_t *builder, uint32_t mode_bitmask, const char *args, const char *description, bool is_utility_command)
Add an example with utility command support.
Definition builder.c:1289
options_builder_t * options_builder_create(size_t struct_size)
Create empty options builder.
Definition builder.c:378
asciichat_error_t acds_string_generate(char *output, size_t output_size)
Generate random session string.
#define SET_ERRNO(code, context_msg,...)
Set error code with custom context message and log it, returning the error code.
asciichat_error_t
Error and exit codes - unified status values (0-255)
Definition error_codes.h:49
@ ERROR_MEMORY
Definition error_codes.h:56
@ ASCIICHAT_OK
Definition error_codes.h:51
#define OPTION_MODE_CLIENT_LIKE
#define OPTION_MODE_SERVER_LIKE
Mode group macros for examples.
@ OPTION_MODE_ALL
All modes + binary.
@ OPTION_MODE_BINARY
Binary-level options (parsed before mode detection)
@ OPTION_MODE_CLIENT
Client mode (bit 1)
@ OPTION_MODE_DISCOVERY
Discovery mode (bit 4)
@ OPTION_MODE_SERVER
Server mode (bit 0)
@ OPTION_MODE_MIRROR
Mirror mode (bit 2)
@ OPTION_MODE_DISCOVERY_SVC
Discovery server mode (bit 3)
int safe_snprintf(char *buffer, size_t buffer_size, const char *format,...)
Safe formatted string printing to buffer.
Definition system.c:148
int parse_server_bind_address(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse server bind address positional argument.
Definition parsers.c:563
int parse_mirror_media(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse mirror mode positional argument (file path or URL)
Definition parsers.c:879
int parse_client_address(const char *arg, void *config, char **remaining, int num_remaining, char **error_msg)
Parse client address positional argument.
Definition parsers.c:685
asciichat_error_t options_registry_add_all_to_builder(options_builder_t *builder)
Add all options from registry to builder.
Definition public_api.c:20
#define SESSION_STRING_BUFFER_SIZE
Options builder.
Definition builder.h:441
const char * program_name
Definition builder.h:471
const char * description
Definition builder.h:472
Options configuration.
Definition builder.h:401
Consolidated options structure.

References acds_string_generate(), ASCIICHAT_OK, options_builder_t::description, ERROR_MEMORY, OPTION_MODE_ALL, OPTION_MODE_BINARY, OPTION_MODE_CLIENT, OPTION_MODE_CLIENT_LIKE, OPTION_MODE_DISCOVERY, OPTION_MODE_DISCOVERY_SVC, OPTION_MODE_MIRROR, OPTION_MODE_SERVER, OPTION_MODE_SERVER_LIKE, options_builder_add_custom_section(), options_builder_add_dependency_conflicts(), options_builder_add_dependency_requires(), options_builder_add_example(), options_builder_add_example_utility(), options_builder_add_mode(), options_builder_add_positional(), options_builder_add_usage(), options_builder_build(), options_builder_create(), options_builder_destroy(), options_registry_add_all_to_builder(), parse_client_address(), parse_mirror_media(), parse_server_bind_address(), options_builder_t::program_name, safe_snprintf(), SESSION_STRING_BUFFER_SIZE, and SET_ERRNO.

Referenced by action_create_config(), action_create_manpage(), config_create_default(), options_init(), and usage().