functions that manipulate strings
Add space characters to the colored string so that its length will be at least 'len' characters.
Don't trim the string if it is longer than 'len'.
- Parameters
-
str | pointer to colored string to modify (may not be NULL) |
bufsize | size of the buffer with the string |
len | the desired length of the string |
- Returns
- pointer to the end of input string
Remove trailing space characters from a string.
- Parameters
-
str | pointer to string to modify (may be NULL) |
- Returns
- pointer to input string
Skip whitespaces in the string.
- Returns
- pointer to first non-whitespace char in given string
char* skip_spaces |
( |
char * |
ptr | ) |
|
|
inline |
- Parameters
-
- Returns
- pointer to first non-whitespace char in given string
Performs some cleanup operations to a line.
- Parameters
-
buf | string to modify |
cmt_char | character that denotes the start of a comment:
- the entire text is removed if the line begins with this character (ignoring leading spaces)
- all text after (and including) this character is removed if flag CLNL_FINDCMT is set
|
flags | a combination of line cleanup flags. defaults to CLNL_TRIM |
- Returns
- length of line
Find a line with the specified code in the strarray_t array.
If the last element of the array has code==0 then it is considered as the default entry.
If no default entry exists and the code is not found, strarray() returns "".