args_get()
Read command-line argument data.
Description
The args_get()
function is used to read the command-line argument data provided to the WebAssembly module. The sizes of the buffers should match the values returned by the args_sizes_get()
function.
Syntax
;;; passed to the program by the user.
;;; and may even be a fixed string. Subsequent arguments are the arguments
;;; program. This need not be a usable filesystem path or even file name,
;;; The first argument should be a string containing the "name" of the
;;;
;;; Each argument is expected to be `\0` terminated.
;;;
;;; The size of the array should match that returned by `args_sizes_get`.
;;;
;;; Read command-line argument data.
(@interface func (export "args_get")
(param $argv (@witx pointer (@witx pointer u8)))
(param $argv_buf (@witx pointer u8))
(result $error (expected (error $errno)))
)
Parameters
ctx
: A mutable reference to the function environment.argv
: A WebAssembly pointer to a buffer where the argument pointers will be written.argv_buf
: A WebAssembly pointer to a buffer where the argument string data will be written.
Return Value
The function returns an Errno
value indicating the success or failure of the operation.
Logging
This function has been instrumented with debug-level logging. It will log the following information:
args
: The command-line arguments in the WebAssembly module.
Please make sure the logging configuration is properly set up to capture the desired logs.
Note
The args_get()
function reads the command-line argument data provided to the WebAssembly module. The argument pointers and string data are written to the specified buffers. The actual data is retrieved from the WebAssembly module's state.