ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
manpage.c File Reference

Manpage resource stubs for WASM (not needed for mirror mode) More...

Go to the source code of this file.

Functions

int get_manpage_template (FILE **out_file, const char **out_content, size_t *out_len)
 Get man page template source (embedded or filesystem)
 
int get_manpage_content (FILE **out_file, const char **out_content, size_t *out_len)
 Get man page content source (embedded or filesystem)
 
void release_manpage_resources (FILE *file)
 Release resources obtained from get_manpage_*.
 

Detailed Description

Manpage resource stubs for WASM (not needed for mirror mode)

Definition in file platform/wasm/stubs/manpage.c.

Function Documentation

◆ get_manpage_content()

int get_manpage_content ( FILE **  out_file,
const char **  out_content,
size_t *  out_len 
)

Get man page content source (embedded or filesystem)

Same behavior as get_manpage_template() but for the content file. See get_manpage_template() documentation for usage details.

Parameters
out_fileOutput pointer for FILE* (development) or NULL (production)
out_contentOutput pointer for const char* (production) or NULL (dev)
out_lenOutput pointer for size_t (production) or NULL (development)
Returns
0 on success, -1 on error

Definition at line 28 of file platform/wasm/stubs/manpage.c.

28 {
29 if (!out_file || !out_content || !out_len) {
30 return -1;
31 }
32
33 // Return embedded empty string (WASM doesn't support man pages)
34 *out_file = NULL;
35 *out_content = empty_manpage;
36 *out_len = empty_manpage_len;
37 return 0;
38}

◆ get_manpage_template()

int get_manpage_template ( FILE **  out_file,
const char **  out_content,
size_t *  out_len 
)

Get man page template source (embedded or filesystem)

Automatically selects between embedded and filesystem resources based on build type:

  • Release builds (NDEBUG defined): Returns embedded string
  • Debug builds (NDEBUG undefined): Reads from filesystem

Parameter Usage:

  • In production: out_content and out_len are set, out_file is NULL
  • In development: out_file is set to open FILE*, others are NULL
  • Caller must check which one is non-NULL to determine source
Parameters
out_fileOutput pointer for FILE* (development) or NULL (production)
out_contentOutput pointer for const char* (production) or NULL (dev)
out_lenOutput pointer for size_t (production) or NULL (development)
Returns
0 on success, -1 on error
Note
Caller must call release_manpage_resources(out_file) when done
Do NOT free out_content - it's either static or managed elsewhere

Definition at line 15 of file platform/wasm/stubs/manpage.c.

15 {
16 if (!out_file || !out_content || !out_len) {
17 return -1;
18 }
19
20 // Return embedded empty string (WASM doesn't support man pages)
21 *out_file = NULL;
22 *out_content = empty_manpage;
23 *out_len = empty_manpage_len;
24 return 0;
25}

◆ release_manpage_resources()

void release_manpage_resources ( FILE *  file)

Release resources obtained from get_manpage_*.

Properly cleans up resources based on build type:

  • Production: No-op (embedded strings are static)
  • Development: Closes FILE* if non-NULL
Parameters
fileFILE* obtained from get_manpage_template/content(), or NULL
Note
Safe to call with NULL
Only closes file, does NOT free content pointer

Definition at line 40 of file platform/wasm/stubs/manpage.c.

40 {
41 if (file) {
42 fclose(file);
43 }
44}