PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
Argument parsing

Standardized argument parsing. More...

Collaboration diagram for Argument parsing:

Detailed Description

Standardized argument parsing.

The sys/argsplit.h header provides a system for standardized argument parsing, allowing arguments to be parsed in the same way in various parts of the operating system.

Functions

const char ** argsplit (const char *str, uint64_t maxLen, uint64_t *count)
 Standardized argument parsing function.
 
const char ** argsplit_buf (void *buf, uint64_t size, const char *str, uint64_t maxLen, uint64_t *count)
 Standardized argument parsing function using a provided buffer.
 

Function Documentation

◆ argsplit()

const char ** argsplit ( const char *  str,
uint64_t  maxLen,
uint64_t count 
)

Standardized argument parsing function.

The argsplit() function parses a input string and splits it into a NULL-terminated array of strings factoring in escape chars spaces and quotation marks.

Parameters
strThe input string to be parsed.
maxLenThe maximum length of the input string.
countA pointer to a uint64_t where the number of parsed arguments will be stored.
Returns
On success, returns a NULL-terminated array of strings (the parsed arguments). On failure, returns NULL.

Definition at line 3 of file argsplit.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ argsplit_buf()

const char ** argsplit_buf ( void *  buf,
uint64_t  size,
const char *  str,
uint64_t  maxLen,
uint64_t count 
)

Standardized argument parsing function using a provided buffer.

The argsplit_buf() function is similar to argsplit() but uses a pre-allocated buffer for storing the parsed arguments, useful for memory management.

Parameters
bufA pointer to the buffer to be used for storing the parsed arguments.
sizeThe size of the provided buffer.
strThe input string to be parsed.
maxLenThe maximum length of the input string.
countA pointer to a uint64_t where the number of parsed arguments will be stored.
Returns
On success, returns a NULL-terminated array of strings (the parsed arguments) stored within the provided buffer. On failure, returns NULL.

Definition at line 3 of file argsplit_buf.c.

Here is the call graph for this function:
Here is the caller graph for this function: