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

Utility stubs for WASM/Emscripten (backtrace, localtime) More...

Go to the source code of this file.

Functions

int platform_backtrace (void **buffer, int size)
 Get a backtrace of the current call stack.
 
char ** platform_backtrace_symbols (void *const *buffer, int size)
 Convert backtrace addresses to symbol names.
 
void platform_backtrace_symbols_destroy (char **symbols)
 Free symbol array from platform_backtrace_symbols()
 
void platform_print_backtrace_symbols (const char *label, char **symbols, int count, int skip_frames, int max_frames, backtrace_frame_filter_t filter)
 
void platform_print_backtrace (int skip_frames)
 
asciichat_error_t platform_localtime (const time_t *timer, struct tm *result)
 Platform-safe localtime wrapper.
 
int platform_isatty (int fd)
 Check if a file descriptor is a terminal.
 
void platform_clear_error_state (void)
 
bool platform_get_temp_dir (char *temp_dir, size_t path_size)
 Get the system temporary directory path.
 
bool platform_prompt_yes_no (const char *question, bool default_yes)
 Prompt the user for a yes/no answer.
 
int platform_get_last_error (void)
 Get the last system error code.
 
const char * platform_get_home_dir (void)
 Get the user's home directory.
 
void platform_normalize_path_separators (char *path)
 Normalize path separators for the current platform.
 
char * platform_get_config_dir (void)
 Get the application configuration directory.
 
bool platform_get_cwd (char *cwd, size_t path_size)
 Get the current working directory of the process.
 
int platform_path_strcasecmp (const char *a, const char *b, size_t n)
 Platform-aware path string comparison.
 
int platform_is_regular_file (const char *path)
 Check if a path is a regular file.
 

Detailed Description

Utility stubs for WASM/Emscripten (backtrace, localtime)

Definition in file util.c.

Function Documentation

◆ platform_isatty()

int platform_isatty ( int  fd)

Check if a file descriptor is a terminal.

Parameters
fdFile descriptor to check
Returns
Non-zero if fd is a terminal, 0 otherwise

Definition at line 63 of file util.c.

63 {
64 (void)fd;
65 return 1; // Always true for the browser terminal
66}

Referenced by session_display_create(), splash_intro_start(), terminal_is_stderr_tty(), terminal_is_stdin_tty(), terminal_is_stdout_tty(), terminal_should_color_output(), terminal_should_use_control_sequences(), and ui_status_display().

◆ platform_print_backtrace()

void platform_print_backtrace ( int  skip_frames)

Definition at line 44 of file util.c.

44 {
45 (void)skip_frames;
46 // No-op - backtrace not supported in WASM
47}

◆ platform_print_backtrace_symbols()

void platform_print_backtrace_symbols ( const char *  label,
char **  symbols,
int  count,
int  skip_frames,
int  max_frames,
backtrace_frame_filter_t  filter 
)

Definition at line 33 of file util.c.

34 {
35 (void)label;
36 (void)symbols;
37 (void)count;
38 (void)skip_frames;
39 (void)max_frames;
40 (void)filter;
41 // No-op - backtrace not supported in WASM
42}