pam_pkcs11 0.6.12
|
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | M_EXTERN extern |
String management library. | |
Functions | |
M_EXTERN int | is_empty_str (const char *str) |
Check for a null or spaced string. | |
M_EXTERN char * | clone_str (const char *str) |
Duplicate a string. | |
M_EXTERN char * | toupper_str (const char *str) |
Duplicate a string converting all chars to upper-case. | |
M_EXTERN char * | tolower_str (const char *str) |
Duplicate a string converting all chars to lower-case. | |
M_EXTERN char * | bin2hex (const unsigned char *binstr, const int len) |
Convert a byte array into a colon-separated hexadecimal sequence. | |
M_EXTERN unsigned char * | hex2bin (const char *hexstr) |
Convert a colon-separated hexadecimal data into a byte array. | |
M_EXTERN unsigned char * | hex2bin_static (const char *hexstr, unsigned char **res, int *size) |
Convert a colon-separated hexadecimal data into a byte array, store result into a previously allocated space. | |
M_EXTERN char ** | split (const char *str, char sep, int nelems) |
Splits a string to an array of nelems by using sep as character separator. | |
M_EXTERN char ** | split_static (const char *str, char sep, int nelems, char *dst) |
Splits a string to an array of nelems by using sep as character separator, using dest as pre-allocated destination memory for the resulting array. | |
M_EXTERN char * | trim (const char *str) |
Remove all extra spaces from a string. | |
#define M_EXTERN extern |
String management library.
Definition at line 37 of file strings.h.
Referenced by bin2hex(), clone_str(), hex2bin(), hex2bin_static(), is_empty_str(), split(), split_static(), tolower_str(), toupper_str(), and trim().
M_EXTERN char * bin2hex | ( | const unsigned char * | binstr, |
const int | len ) |
Convert a byte array into a colon-separated hexadecimal sequence.
binstr | ByteArray to be parsed |
len | Number of bytes to be converted |
References M_EXTERN.
M_EXTERN char * clone_str | ( | const char * | str | ) |
Duplicate a string.
str | String to be cloned |
References M_EXTERN.
M_EXTERN unsigned char * hex2bin | ( | const char * | hexstr | ) |
Convert a colon-separated hexadecimal data into a byte array.
hexstr | String to be parsed |
References M_EXTERN.
M_EXTERN unsigned char * hex2bin_static | ( | const char * | hexstr, |
unsigned char ** | res, | ||
int * | size ) |
Convert a colon-separated hexadecimal data into a byte array, store result into a previously allocated space.
hexstr | String to be parsed |
res | Pointer to pre-allocated user space |
size | Pointer to store lenght of data parsed |
References M_EXTERN.
M_EXTERN int is_empty_str | ( | const char * | str | ) |
Check for a null or spaced string.
str | Tested string |
References M_EXTERN.
M_EXTERN char ** split | ( | const char * | str, |
char | sep, | ||
int | nelems ) |
Splits a string to an array of nelems by using sep as character separator.
To free() memory used by this call, call free(res[0]); free(res);
str | String to be parsed |
sep | Character to be used as separator |
nelems | Number of elements of resulting array |
References M_EXTERN.
M_EXTERN char ** split_static | ( | const char * | str, |
char | sep, | ||
int | nelems, | ||
char * | dst ) |
Splits a string to an array of nelems by using sep as character separator, using dest as pre-allocated destination memory for the resulting array.
To free() memory used by this call, just call free result pointer
str | String to be parsed |
sep | Character to be used as separator |
nelems | Number of elements of resulting array |
dst | Char array to store temporary data |
References M_EXTERN.
M_EXTERN char * tolower_str | ( | const char * | str | ) |
Duplicate a string converting all chars to lower-case.
str | String to be cloned & lowercased |
References M_EXTERN.
M_EXTERN char * toupper_str | ( | const char * | str | ) |
Duplicate a string converting all chars to upper-case.
str | String to be cloned & uppercassed |
References M_EXTERN.