|
CNDP 22.08.0
|
#include <stdio.h>#include <ctype.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <netinet/in.h>#include <arpa/inet.h>#include <bsd/bsd.h>#include <errno.h>#include <bsd/string.h>#include <sys/socket.h>#include <cne_common.h>Go to the source code of this file.
Enumerations | |
| enum | { STR_MAX_ARGVS = 64 , STR_TOKEN_SIZE = 128 } |
Functions | |
| static __inline__ char * | strtrimset (char *str, const char *set) |
| static __inline__ char * | strtrim_quotes (char *str) |
| static __inline__ char * | strtrim (char *str) |
| static __inline__ int | cne_strtok (char *str, const char *delim, char *entries[], int maxtokens) |
| static __inline__ int | cne_strqtok (char *str, const char *delim, char *argv[], int maxtokens) |
| static __inline__ char * | cne_strtolower (char *str) |
| static __inline__ char * | cne_strtoupper (char *str) |
| static __inline__ int | cne_stropt (const char *list, char *str, const char *delim) |
| static __inline__ char * | cne_strdupf (char *str, char *newstr) |
| static __inline__ int | cne_strcnt (char *s, char c) |
| static __inline__ int | mask_size (uint32_t mask) |
String-related utility functions
Definition in file cne_strings.h.
| anonymous enum |
| Enumerator | |
|---|---|
| STR_MAX_ARGVS | Max number of args to support |
| STR_TOKEN_SIZE | Token max size |
Definition at line 33 of file cne_strings.h.
|
static |
Trim a set of characters like "[]" or "{}" from the start and end of string.
| str | A null terminated string to be trimmed. |
| set | The set string is a set of two character values to be removed from the str. Removes only one set at a time, if you have more then one set to remove then you must call the routine for each set. The set string must be two characters and can be any characters you want to call a set. |
Definition at line 53 of file cne_strings.h.
|
static |
Remove quotes from around a string helper routine.
| str | String to remove the quote marks or tick marks from around a string |
Definition at line 83 of file cne_strings.h.
|
static |
Remove leading and trailing white space from a string.
| str | String to be trimmed, must be null terminated |
str is Null or if string is empty then return pointer to str Definition at line 104 of file cne_strings.h.
|
static |
Parse a string into a argc/argv list using a set of delimiters, but does not handle quoted strings within the string being parsed.
| str | String to be tokenized and will be modified, must be null terminated |
| delim | A null terminated list of delimiters |
| entries | A pointer to an array to place the token pointers |
| maxtokens | Max number of tokens to be placed in entries |
entries array. Definition at line 142 of file cne_strings.h.
|
static |
Parse a string into a argv list using a set of delimiters, but does handle quoted strings within the string being parsed
| str | String to be tokenized and will be modified, null terminated |
| delim | A null terminated list of delimiters |
| argv | A pointer to an array to place the token pointers |
| maxtokens | Max number of tokens to be placed in entries |
entries array. Definition at line 176 of file cne_strings.h.
|
static |
Convert characters in str to lowercase.
| str | String to convert to lowercase |
Definition at line 272 of file cne_strings.h.
|
static |
Convert characters in str to uppercase.
| str | String to convert to uppercase |
Definition at line 293 of file cne_strings.h.
|
static |
Parse a string list looking for str using delim character.
| list | A string list of options with delim character between them. |
| str | String to search for in list |
| delim | A character string to use as a delim values |
Definition at line 317 of file cne_strings.h.
|
static |
The function is a wrapper around strdup() and will free the previous string if the pointer is present.
Definition at line 352 of file cne_strings.h.
|
static |
Count the number of c characters in a string s
| s | Null terminated string to search |
| c | character to count |
Definition at line 370 of file cne_strings.h.
|
static |
Return the number of contiguous bits in a 32bit mask variable.
The mask can not contain gaps between bits, must be contiguous from MSB.
| mask | The mask variable to determine the number of bits. |
Definition at line 388 of file cne_strings.h.