Skip to content

File wsh_shell_promptwait.c

FileList > src > wsh_shell_promptwait.c

Go to the source code of this file

  • #include "wsh_shell_promptwait.h"

Public Functions

Type Name
void WshShellPromptWait_Attach (WshShellPromptWait_t * pWait, WshShellPromptWait_Handler_t handler, void * pCtx)
Attach a one-time input handler.
WshShell_Bool_t WshShellPromptWait_Enter (WshShell_Char_t symbol, WshShellPromptWait_t * pWait)
User input handler for prompt-wait mode.
void WshShellPromptWait_Flush (WshShellPromptWait_t * pWait)
Flush the current prompt-wait mode.
WSH_SHELL_RET_STATE_t WshShellPromptWait_Handle (WshShellPromptWait_t * pWait, WshShell_Char_t symbol)
Handle a symbol when in prompt-wait mode.
WshShell_Bool_t WshShellPromptWait_YesNo (WshShell_Char_t symbol, WshShellPromptWait_t * pWait)

Public Functions Documentation

function WshShellPromptWait_Attach

Attach a one-time input handler.

1
2
3
4
5
void WshShellPromptWait_Attach (
    WshShellPromptWait_t * pWait,
    WshShellPromptWait_Handler_t handler,
    void * pCtx
) 

Replaces normal shell input handling with a temporary callback. The callback will receive the first character entered by the user, after which it should typically disable itself by calling WshShellPromptWait_Flush().

Parameters:

  • pWait Pointer to prompt-wait control object.
  • handler Callback function to invoke on user input.
  • pCtx Optional pointer to user context.

function WshShellPromptWait_Enter

User input handler for prompt-wait mode.

1
2
3
4
WshShell_Bool_t WshShellPromptWait_Enter (
    WshShell_Char_t symbol,
    WshShellPromptWait_t * pWait
) 

Processes a character entered by the user while waiting for specific input (e.g., Enter key, Y/N confirmation, etc.).

Parameters:

  • symbol The character entered by the user.
  • pWait Pointer to the prompt-wait control structure.

Returns:

WshShell_Bool_t * true if the input was handled and waiting can end; * false if waiting should continue.


function WshShellPromptWait_Flush

Flush the current prompt-wait mode.

1
2
3
void WshShellPromptWait_Flush (
    WshShellPromptWait_t * pWait
) 

Resets the handler to NULL so that normal shell input is processed.

Parameters:

  • pWait Pointer to prompt-wait control object.

function WshShellPromptWait_Handle

Handle a symbol when in prompt-wait mode.

1
2
3
4
WSH_SHELL_RET_STATE_t WshShellPromptWait_Handle (
    WshShellPromptWait_t * pWait,
    WshShell_Char_t symbol
) 

If a handler is set, it is called with the given symbol and context.

Parameters:

  • pWait Pointer to prompt-wait control object.
  • symbol Character entered by the user.

Returns:

WSH_SHELL_RET_STATE_ERR_PARAM if some problems with input params WSH_SHELL_RET_STATE_ERR_EMPTY if there are no handler attached WSH_SHELL_RET_STATE_ERR_BUSY if normal shell processing should continue WSH_SHELL_RET_STATE_SUCCESS if the symbol was handled by the prompt-wait mechanism


function WshShellPromptWait_YesNo

1
2
3
4
WshShell_Bool_t WshShellPromptWait_YesNo (
    WshShell_Char_t symbol,
    WshShellPromptWait_t * pWait
) 


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