Skip to content

File wsh_shell_ps1_custom.c

FileList > src > wsh_shell_ps1_custom.c

Go to the source code of this file

  • #include "wsh_shell_ps1_custom.h"

Public Functions

Type Name
void WshShell_GeneratePS1 (WshShell_Char_t * pPS1, WshShell_PS1Data_t * pPS1Data)
Applies the PS1 template and generates the final PS1 string.

Public Functions Documentation

function WshShell_GeneratePS1

Applies the PS1 template and generates the final PS1 string.

1
2
3
4
void WshShell_GeneratePS1 (
    WshShell_Char_t * pPS1,
    WshShell_PS1Data_t * pPS1Data
) 

Expands a predefined PS1 template (WSH_SHELL_PS1_TEMPLATE) into a complete PS1 string, substituting special format specifiers with runtime values like username, device name, and ANSI escape sequences for styling (colors, bold, reset).

Supported format specifiers in the template: * u — current username (from pUser) * d — current device name (from pDevice) * cN — ANSI color code from predefined color map (0 ≤ N ≤ 9) * b — ANSI escape sequence for bold text * r — ANSI escape sequence to reset all styles * Any unknown % sequence is copied verbatim as X.

The output is truncated if it would exceed WSH_SHELL_PS1_MAX_LEN - 1. The result is always null-terminated.

Parameters:

  • pPS1 Output buffer for the final PS1 string. Must be at least WSH_SHELL_PS1_MAX_LEN in size.
  • pPS1Data Pointer to the user name, divice name or other strings.


The documentation for this class was generated from the following file src/wsh_shell_ps1_custom.c