|
PatchworkOS
|
Standardized argument parsing. More...
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. | |
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.
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.
| str | The input string to be parsed. |
| maxLen | The maximum length of the input string. |
| count | A pointer to a uint64_t where the number of parsed arguments will be stored. |
NULL-terminated array of strings (the parsed arguments). On failure, returns NULL. Definition at line 3 of file argsplit.c.
References _argsplit_backend(), _argsplit_count_chars_and_args(), count, isspace(), malloc(), NULL, and UINT64_MAX.
Referenced by pipeline_init().
| 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.
| buf | A pointer to the buffer to be used for storing the parsed arguments. |
| size | The size of the provided buffer. |
| str | The input string to be parsed. |
| maxLen | The maximum length of the input string. |
| count | A pointer to a uint64_t where the number of parsed arguments will be stored. |
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.
References _argsplit_backend(), _argsplit_count_chars_and_args(), count, isspace(), NULL, and UINT64_MAX.
Referenced by ctl_dispatch().