![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | N_STR |
| A box including a string and his lenght. More... | |
Macros | |
| #define | free_nstr(__ptr) |
| free a N_STR structure and set the pointer to NULL | |
| #define | local_strdup(__src_) |
| Do tar(1) matching rules, which ignore a trailing slash? | |
| #define | n_remove_ending_cr(__nstr_var) |
| Remove carriage return (backslash r) if there is one in the last position of the string. | |
| #define | n_replace_cr(__nstr_var, __replacement) |
| Find and replace all occurences of carriage return (backslash r) in the string. | |
| #define | nstrcat(__nstr_dst, __nstr_src) |
| Macro to quickly concatenate two N_STR. | |
| #define | nstrcat_bytes(__nstr_dst, __void_src) nstrcat_bytes_ex(&(__nstr_dst), __void_src, strlen(__void_src)) |
| Macro to quickly concatenate a '\0' ended byte stream to a N_STR. | |
| #define | nstrprintf(__nstr_var, __format, ...) nstrprintf_ex(&(__nstr_var), (__format), ##__VA_ARGS__) |
| Macro to quickly allocate and sprintf to N_STR. | |
| #define | nstrprintf_cat(__nstr_var, __format, ...) nstrprintf_cat_ex(&(__nstr_var), (__format), ##__VA_ARGS__) |
| Macro to quickly allocate and sprintf and cat to a N_STR. | |
| #define | strprintf(__n_var, ...) |
| Macro to quickly allocate and sprintf to a char. | |
| #define | WILDMAT_ABORT -2 |
| Abort code to sped up pattern matching. | |
| #define | WILDMAT_NEGATE_CLASS '^' |
| What character marks an inverted character class? | |
Typedefs | |
| typedef size_t | NSTRBYTE |
| N_STR base unit. | |
Functions | |
| int | _free_nstr (N_STR **ptr) |
| Free a N_STR structure and set the pointer to NULL. | |
| N_STR * | char_to_nstr (const char *src) |
| Convert a char into a N_STR, short version. | |
| int | char_to_nstr_ex (const char *from, NSTRBYTE nboct, N_STR **to) |
| Convert a char into a N_STR, extended version. | |
| N_STR * | char_to_nstr_nocopy (char *src) |
| Convert a char into a N_STR, direct use of linked source pointer. | |
| int | char_to_nstr_nocopy_ex (char *from, NSTRBYTE nboct, N_STR **to) |
| int | empty_nstr (N_STR *nstr) |
| empty a N_STR string | |
| N_STR * | file_to_nstr (char *filename) |
| Load a whole file into a N_STR. | |
| int | free_nstr_nolog (N_STR **ptr) |
| Free a N_STR structure and set the pointer to NULL. | |
| void | free_nstr_ptr (void *ptr) |
| Free a N_STR pointer structure. | |
| void | free_nstr_ptr_nolog (void *ptr) |
| Free a N_STR pointer structure. | |
| int | free_split_result (char ***tab) |
| Free a split result allocated array. | |
| char * | join (char **splitresult, char *delim) |
| join the array into a string | |
| N_STR * | new_nstr (NSTRBYTE size) |
| create a new N_STR string | |
| char * | nfgets (char *buffer, NSTRBYTE size, FILE *stream) |
| try to fgets | |
| int | nstr_to_fd (N_STR *str, FILE *out, int lock) |
| Write a N_STR content into a file. | |
| int | nstr_to_file (N_STR *n_str, char *filename) |
| Write a N_STR content into a file. | |
| N_STR * | nstrcat_bytes_ex (N_STR **dest, void *src, NSTRBYTE size) |
| Append data into N_STR using internal N_STR size and cursor position. | |
| N_STR * | nstrcat_ex (N_STR **dest, void *src, NSTRBYTE size, int resize_flag) |
| Append data into N_STR using internal N_STR size and cursor position. | |
| N_STR * | nstrdup (N_STR *msg) |
| Duplicate a N_STR. | |
| N_STR * | nstrprintf_cat_ex (N_STR **nstr_var, const char *format,...) |
| Function to allocate, format, and concatenate a string into an N_STR object. | |
| N_STR * | nstrprintf_ex (N_STR **nstr_var, const char *format,...) |
| Function to allocate and format a string into an N_STR object. | |
| int | resize_nstr (N_STR *nstr, size_t size) |
| reallocate a nstr internal buffer. | |
| int | scan_dir (const char *dir, LIST *result, const int recurse) |
| Scan a list of directory and return a list of char *file. | |
| int | scan_dir_ex (const char *dir, const char *pattern, LIST *result, const int recurse, const int mode) |
| Scan a list of directory and return a list of char *file. | |
| int | skipu (char *string, char toskip, NSTRBYTE *iterator, int inc) |
| skip until 'toskip' occurence is found from 'iterator' to the next 'toskip' value. | |
| int | skipw (char *string, char toskip, NSTRBYTE *iterator, int inc) |
| skip while 'toskip' occurence is found from 'iterator' to the next non 'toskip' position. | |
| char ** | split (const char *str, const char *delim, int empty) |
| split the strings into a an array of char *pointer , ended by a NULL one. | |
| int | split_count (char **split_result) |
| Count split elements. | |
| char * | str_replace (const char *string, const char *substr, const char *replacement) |
| Replace "substr" by "replacement" inside string taken from http://coding.debuntu.org/c-implementing-str_replace-replace-all-occurrences-substring By Chantra. | |
| int | str_sanitize (char *string, const char *mask, const char replacement) |
| clean a string by replacing evil characteres | |
| int | str_sanitize_ex (char *string, const NSTRBYTE string_len, const char *mask, const NSTRBYTE masklen, const char replacement) |
| clean a string by replacing evil characteres | |
| int | str_to_int (const char *s, int *i, const int base) |
| Helper for string to integer. | |
| int | str_to_int_ex (const char *s, NSTRBYTE start, NSTRBYTE end, int *i, const int base) |
| Helper for string[start to end] to integer. | |
| int | str_to_int_nolog (const char *s, NSTRBYTE start, NSTRBYTE end, int *i, const int base, N_STR **infos) |
| Helper for string[start to end] to integer. | |
| int | str_to_long (const char *s, long int *i, const int base) |
| Helper for string to integer. | |
| int | str_to_long_ex (const char *s, NSTRBYTE start, NSTRBYTE end, long int *i, const int base) |
| Helper for string[start to end] to long integer. | |
| int | str_to_long_long (const char *s, long long int *i, const int base) |
| Helper for string to integer. | |
| int | str_to_long_long_ex (const char *s, NSTRBYTE start, NSTRBYTE end, long long int *i, const int base) |
| Helper for string[start to end] to long long integer. | |
| int | strcpy_u (char *from, char *to, NSTRBYTE to_size, char split, NSTRBYTE *it) |
| Copy from start to dest until from[ iterator ] == split. | |
| int | strlo (char *string, char *dest) |
| Upper case a string. | |
| int | strup (char *string, char *dest) |
| Upper case a string. | |
| char * | trim (char *s) |
| trim and put a \0 at the end, return new char * | |
| char * | trim_nocopy (char *s) |
| trim and zero end the string, WARNING: keep and original pointer to delete the string correctly | |
| int | wildmat (register const char *text, register const char *p) |
| Written by Rich Salz rsalz at osf.org, refurbished by me. | |
| int | wildmatcase (register const char *text, register const char *p) |
| Written by Rich Salz rsalz at osf.org, refurbished by me. | |
| int | write_and_fit (char **dest, NSTRBYTE *size, NSTRBYTE *written, const char *src) |
| concatenate a copy of src of size strlen( src ) to dest, starting at dest[ written ], updating written and size variable, allocation of new blocks of (needed size + 512) if resize is needed. | |
| int | write_and_fit_ex (char **dest, NSTRBYTE *size, NSTRBYTE *written, const char *src, NSTRBYTE src_size, NSTRBYTE additional_padding) |
| concatenate a copy of src of size src_size to dest, starting at dest[ written ], updating written and size variable, allocation of new blocks of (needed size + additional_padding ) if resize is needed. | |
| struct N_STR |
A box including a string and his lenght.
Collaboration diagram for N_STR:| Data Fields | ||
|---|---|---|
| char * | data | the string |
| size_t | length | length of string (in case we wanna keep information after the 0 end of string value) |
| size_t | written | size of the written data inside the string |
| #define free_nstr | ( | __ptr | ) |
free a N_STR structure and set the pointer to NULL
| #define local_strdup | ( | __src_ | ) |
Do tar(1) matching rules, which ignore a trailing slash?
local strdup
| #define n_remove_ending_cr | ( | __nstr_var | ) |
| #define n_replace_cr | ( | __nstr_var, | |
| __replacement | |||
| ) |
Find and replace all occurences of carriage return (backslash r) in the string.
| #define nstrcat | ( | __nstr_dst, | |
| __nstr_src | |||
| ) |
Macro to quickly concatenate two N_STR.
| #define nstrcat_bytes | ( | __nstr_dst, | |
| __void_src | |||
| ) | nstrcat_bytes_ex(&(__nstr_dst), __void_src, strlen(__void_src)) |
| #define nstrprintf | ( | __nstr_var, | |
| __format, | |||
| ... | |||
| ) | nstrprintf_ex(&(__nstr_var), (__format), ##__VA_ARGS__) |
Macro to quickly allocate and sprintf to N_STR.
| #define nstrprintf_cat | ( | __nstr_var, | |
| __format, | |||
| ... | |||
| ) | nstrprintf_cat_ex(&(__nstr_var), (__format), ##__VA_ARGS__) |
Macro to quickly allocate and sprintf and cat to a N_STR.
| #define strprintf | ( | __n_var, | |
| ... | |||
| ) |
Macro to quickly allocate and sprintf to a char.
| #define WILDMAT_ABORT -2 |
Abort code to sped up pattern matching.
Special thanks to Lars Mathiesen thori.nosp@m.nn@d.nosp@m.iku.d.nosp@m.k for the ABORT code.
| #define WILDMAT_NEGATE_CLASS '^' |
| int _free_nstr | ( | N_STR ** | ptr | ) |
| N_STR * char_to_nstr | ( | const char * | src | ) |
Convert a char into a N_STR, short version.
| src | A char *string to convert |
Definition at line 228 of file n_str.c.
References __n_assert, and char_to_nstr_ex().
Referenced by add_strdup_to_msg(), handle_request(), main(), main(), n_vigenere_quick_decode(), and n_vigenere_quick_encode().
Here is the call graph for this function:
Here is the caller graph for this function:Convert a char into a N_STR, extended version.
| from | A char *string to convert |
| nboct | The size to copy, from 1 octet to nboctet (ustrsizez( from ) ) |
| to | A N_STR pointer who will be Malloced |
Definition at line 205 of file n_str.c.
References __n_assert, _str, Free, LOG_ERR, n_log, and new_nstr().
Referenced by char_to_nstr().
Here is the call graph for this function:
Here is the caller graph for this function:| N_STR * char_to_nstr_nocopy | ( | char * | src | ) |
Convert a char into a N_STR, direct use of linked source pointer.
| src | A char *string to use |
Definition at line 241 of file n_str.c.
References __n_assert, data, length, new_nstr(), and written.
Here is the call graph for this function:| int empty_nstr | ( | N_STR * | nstr | ) |
| N_STR * file_to_nstr | ( | char * | filename | ) |
Load a whole file into a N_STR.
Be aware of the NSTRBYTE addressing limit (2GB commonly)
| filename | The filename to load inside a N_STR |
Definition at line 260 of file n_str.c.
References __n_assert, data, free_nstr, LOG_DEBUG, LOG_ERR, n_log, new_nstr(), and written.
Referenced by handle_request(), main(), n_gui_load_dialog(), n_kafka_load_config(), n_kafka_new_event_from_file(), n_vigenere_decode_file(), n_vigenere_decode_file_qa(), n_vigenere_encode_file(), and n_vigenere_encode_file_qa().
Here is the call graph for this function:
Here is the caller graph for this function:| int free_nstr_nolog | ( | N_STR ** | ptr | ) |
| void free_nstr_ptr | ( | void * | ptr | ) |
Free a N_STR pointer structure.
| ptr | A N_STR *object to free |
Definition at line 49 of file n_str.c.
References data, and FreeNoLog.
Referenced by add_nstrdup_to_msg(), add_nstrptr_to_msg(), add_strdup_to_msg(), main(), n_kafka_poll(), netw_add_msg(), netw_add_msg_ex(), netw_recv_func(), and scan_dir_ex().
Here is the caller graph for this function:| void free_nstr_ptr_nolog | ( | void * | ptr | ) |
| int free_split_result | ( | char *** | tab | ) |
Free a split result allocated array.
| tab | A pointer to a split result to free |
Definition at line 970 of file n_str.c.
References Free.
Referenced by handle_request(), load_config_file(), n_kafka_delivery_message_callback(), and split().
Here is the caller graph for this function:| char * join | ( | char ** | splitresult, |
| char * | delim | ||
| ) |
join the array into a string
| splitresult | the split result to join |
| delim | The delimiter, one or more characters |
Definition at line 990 of file n_str.c.
References Malloc.
Referenced by n_kafka_load_config(), and n_kafka_pooling_thread().
Here is the caller graph for this function:create a new N_STR string
| size | Size of the new string. 0 for no allocation. |
Definition at line 180 of file n_str.c.
References __n_assert, data, Free, length, Malloc, and written.
Referenced by char_to_nstr_ex(), char_to_nstr_nocopy(), file_to_nstr(), handle_request(), main(), n_base64_decode(), n_base64_encode(), n_kafka_dump_unprocessed(), n_kafka_load_config(), n_kafka_new(), n_popen(), n_vigenere_get_answer(), n_vigenere_get_question(), n_vigenere_get_rootkey(), nstrcat_ex(), nstrdup(), nstrprintf_cat_ex(), nstrprintf_ex(), send_net_datas(), unzip_nstr(), and zip_nstr().
Here is the caller graph for this function:| char * nfgets | ( | char * | buffer, |
| NSTRBYTE | size, | ||
| FILE * | stream | ||
| ) |
try to fgets
| buffer | The string where to read the file |
| size | Size of the string |
| stream | The file to read |
Definition at line 144 of file n_str.c.
References __n_assert, LOG_ERR, and n_log.
| int nstr_to_fd | ( | N_STR * | str, |
| FILE * | out, | ||
| int | lock | ||
| ) |
Write a N_STR content into a file.
| str | The N_STR *content to write down |
| out | An opened FILE *handler |
| lock | a write lock will be put if lock = 1 |
Definition at line 336 of file n_str.c.
References __n_assert, data, LOG_ERR, n_log, and written.
Referenced by nstr_to_file().
Here is the caller graph for this function:| int nstr_to_file | ( | N_STR * | str, |
| char * | filename | ||
| ) |
Write a N_STR content into a file.
| str | The N_STR *content to write down |
| filename | The destination filename |
Definition at line 386 of file n_str.c.
References __n_assert, _str, LOG_DEBUG, LOG_ERR, n_log, nstr_to_fd(), and written.
Referenced by main(), n_kafka_dump_unprocessed(), n_vigenere_decode_file(), n_vigenere_decode_file_qa(), n_vigenere_encode_file(), and n_vigenere_encode_file_qa().
Here is the call graph for this function:
Here is the caller graph for this function:Append data into N_STR using internal N_STR size and cursor position.
Wrapper to nstrcat_ex, with resize_flag on and a block size one byte higher than size.
| dest | The N_STR **destination (accumulator) |
| data | The data to append |
| size | The number of octet of data we want to append in dest |
Definition at line 1072 of file n_str.c.
References __n_assert, LOG_ERR, n_log, and nstrcat_ex().
Here is the call graph for this function:Append data into N_STR using internal N_STR size and cursor position.
| dest | The N_STR *destination (accumulator) |
| src | The data to append |
| size | The number of octet of data we want to append in dest |
| resize_flag | Set it to a positive non zero value to allow resizing, or to zero to forbid resizing |
Definition at line 1030 of file n_str.c.
References __n_assert, Free, LOG_ERR, n_log, new_nstr(), and Reallocz.
Referenced by nstrcat_bytes_ex().
Here is the call graph for this function:
Here is the caller graph for this function:Duplicate a N_STR.
| str | A N_STR *object to free |
Definition at line 670 of file n_str.c.
References __n_assert, data, Free, length, LOG_ERR, n_log, new_nstr(), and written.
Referenced by add_nstrdup_to_msg(), main(), n_vigenere_cypher(), netw_pool_broadcast(), and userlist_add_msg_to_ex().
Here is the call graph for this function:
Here is the caller graph for this function:Function to allocate, format, and concatenate a string into an N_STR object.
| nstr_var | Pointer to a pointer to the N_STR object to allocate/resize and concatenate. |
| format | The format string (like printf). |
| ... | Variadic arguments for formatting. |
Definition at line 1487 of file n_str.c.
References __n_assert, LOG_ERR, n_log, new_nstr(), and resize_nstr().
Here is the call graph for this function:Function to allocate and format a string into an N_STR object.
| nstr_var | Pointer to a pointer to the N_STR object to allocate/resize. |
| format | The format string (like printf). |
| ... | Arguments to be formatted. |
Definition at line 1442 of file n_str.c.
References __n_assert, LOG_ERR, n_log, new_nstr(), and resize_nstr().
Here is the call graph for this function:| int resize_nstr | ( | N_STR * | nstr, |
| size_t | size | ||
| ) |
reallocate a nstr internal buffer.
Warning: N_STR content will be reset if size = 0 !
| nstr | targeted N_STR *string |
| size | new internal buffer size |
Definition at line 1413 of file n_str.c.
References __n_assert, data, Free, length, Malloc, Reallocz, and written.
Referenced by nstrprintf_cat_ex(), and nstrprintf_ex().
Here is the caller graph for this function:| int scan_dir | ( | const char * | dir, |
| LIST * | result, | ||
| const int | recurse | ||
| ) |
Scan a list of directory and return a list of char *file.
| dir | The directory to scan |
| result | A pointer to a valid LIST for the results |
| recurse | Recursive search if TRUE, directory only if FALSE |
Definition at line 1137 of file n_str.c.
References scan_dir_ex().
Here is the call graph for this function:| int scan_dir_ex | ( | const char * | dir, |
| const char * | pattern, | ||
| LIST * | result, | ||
| const int | recurse, | ||
| const int | mode | ||
| ) |
Scan a list of directory and return a list of char *file.
| dir | The directory to scan |
| pattern | Pattern that files must follow to figure in the list |
| result | A pointer to a valid LIST for the results |
| recurse | Recursive search if TRUE, directory only if FALSE |
| mode | 0 for a list of char* , 1 for a list of N_STR * |
Definition at line 1150 of file n_str.c.
References data, free_nstr, free_nstr_ptr(), list_push(), LOG_ERR, mode, n_log, nstrprintf, scan_dir_ex(), and wildmatcase().
Referenced by scan_dir(), and scan_dir_ex().
Here is the call graph for this function:
Here is the caller graph for this function:| int skipu | ( | char * | string, |
| char | toskip, | ||
| NSTRBYTE * | iterator, | ||
| int | inc | ||
| ) |
skip until 'toskip' occurence is found from 'iterator' to the next 'toskip' value.
The new iterator index is automatically stored, returning to it first value if an error append.
| string | a char *stri:wqng to search in |
| toskip | skipping while char character 'toskip' isnt found |
| iterator | an int iteraor position on the string |
| inc | an int to specify the step of skipping |
Definition at line 750 of file n_str.c.
References __n_assert.
Referenced by load_config_file().
Here is the caller graph for this function:| int skipw | ( | char * | string, |
| char | toskip, | ||
| NSTRBYTE * | iterator, | ||
| int | inc | ||
| ) |
skip while 'toskip' occurence is found from 'iterator' to the next non 'toskip' position.
The new iterator index is automatically stored, returning to it first value if an error append.
| string | a char *string to search in |
| toskip | skipping while char character 'toskip' is found |
| iterator | an int iteraor position on the string |
| inc | an int to specify the step of skipping |
Definition at line 701 of file n_str.c.
References __n_assert.
| char ** split | ( | const char * | str, |
| const char * | delim, | ||
| int | empty | ||
| ) |
split the strings into a an array of char *pointer , ended by a NULL one.
| str | The char *str to split |
| delim | The delimiter, one or more characters |
| empty | Empty flag. If 1, then empty delimited areas will be added as NULL entries, else they will be skipped. |
Definition at line 874 of file n_str.c.
References __n_assert, free_split_result(), and Malloc.
Referenced by handle_request(), n_kafka_delivery_message_callback(), n_kafka_load_config(), and strcpy_u().
Here is the call graph for this function:
Here is the caller graph for this function:| int split_count | ( | char ** | split_result | ) |
Count split elements.
| split_result | A char **result from a split call |
Definition at line 954 of file n_str.c.
References __n_assert.
Referenced by load_config_file(), n_kafka_delivery_message_callback(), and n_kafka_load_config().
Here is the caller graph for this function:| char * str_replace | ( | const char * | string, |
| const char * | substr, | ||
| const char * | replacement | ||
| ) |
Replace "substr" by "replacement" inside string taken from http://coding.debuntu.org/c-implementing-str_replace-replace-all-occurrences-substring By Chantra.
| string | Original string to modify |
| substr | String to search |
| replacement | Substitution string |
Definition at line 1341 of file n_str.c.
References Malloc.
Referenced by load_config_file().
Here is the caller graph for this function:| int str_sanitize | ( | char * | string, |
| const char * | mask, | ||
| const char | replacement | ||
| ) |
clean a string by replacing evil characteres
| string | The string to change |
| mask | The caracters to kill |
| replacement | replacement for mask |
Definition at line 1403 of file n_str.c.
References str_sanitize_ex().
Here is the call graph for this function:| int str_sanitize_ex | ( | char * | string, |
| const NSTRBYTE | string_len, | ||
| const char * | mask, | ||
| const NSTRBYTE | masklen, | ||
| const char | replacement | ||
| ) |
clean a string by replacing evil characteres
| string | The string to change |
| string_len | Size of the data to treat |
| mask | The caracters to kill |
| masklen | size of mask |
| replacement | replacement for mask |
Definition at line 1380 of file n_str.c.
References __n_assert.
Referenced by str_sanitize().
Here is the caller graph for this function:| int str_to_int | ( | const char * | s, |
| int * | i, | ||
| const int | base | ||
| ) |
Helper for string to integer.
| s | String to convert |
| i | A pointer to an integer variable which will receieve the value. |
| base | Base for converting values |
Definition at line 511 of file n_str.c.
References str_to_int_ex().
Here is the call graph for this function:Helper for string[start to end] to integer.
Automatically add /0 for conversion. Leave values untouched if any error occur. Work on a copy of the chunk.
| s | String to convert |
| start | Start position of the chunk |
| end | End position of the chunk |
| i | A pointer to an integer variable which will receive the value. |
| base | Base for converting values |
Definition at line 424 of file n_str.c.
References __n_assert, Free, LOG_ERR, Malloc, and n_log.
Referenced by str_to_int().
Here is the caller graph for this function:| int str_to_int_nolog | ( | const char * | s, |
| NSTRBYTE | start, | ||
| NSTRBYTE | end, | ||
| int * | i, | ||
| const int | base, | ||
| N_STR ** | infos | ||
| ) |
Helper for string[start to end] to integer.
Automatically add /0 for conversion. Leave values untouched if any error occur. Work on a copy of the chunk.
| s | String to convert |
| start | Start position of the chunk |
| end | End position of the chunk |
| i | A pointer to an integer variable which will receieve the value. |
| base | Base for converting values |
| infos | If not NULL , contain the errors. remember to free the pointer if returned !! |
Definition at line 470 of file n_str.c.
References __n_assert, Free, LOG_ERR, Malloc, n_log, and nstrprintf.
| int str_to_long | ( | const char * | s, |
| long int * | i, | ||
| const int | base | ||
| ) |
Helper for string to integer.
| s | String to convert |
| i | A pointer to an integer variable which will receieve the value. |
| base | Base for converting values |
Definition at line 642 of file n_str.c.
References str_to_long_ex().
Here is the call graph for this function:Helper for string[start to end] to long integer.
Automatically add /0 for conversion. Leave values untouched if any error occur. Work on a copy of the chunk.
| s | String to convert |
| start | Start position of the chunk |
| end | End position of the chunk |
| i | A pointer to an integer variable which will receieve the value. |
| base | Base for converting values |
Definition at line 530 of file n_str.c.
References __n_assert, Free, LOG_DEBUG, LOG_ERR, Malloc, and n_log.
Referenced by str_to_long().
Here is the caller graph for this function:| int str_to_long_long | ( | const char * | s, |
| long long int * | i, | ||
| const int | base | ||
| ) |
Helper for string to integer.
| s | String to convert |
| i | A pointer to an integer variable which will receieve the value. |
| base | Base for converting values |
Definition at line 657 of file n_str.c.
References str_to_long_long_ex().
Here is the call graph for this function:| int str_to_long_long_ex | ( | const char * | s, |
| NSTRBYTE | start, | ||
| NSTRBYTE | end, | ||
| long long int * | i, | ||
| const int | base | ||
| ) |
Helper for string[start to end] to long long integer.
Automatically add /0 for conversion. Leave values untouched if any error occur. Work on a copy of the chunk.
| s | String to convert |
| start | Start position of the chunk |
| end | End position of the chunk |
| i | A pointer to an integer variable which will receieve the value. |
| base | Base for converting values |
Definition at line 587 of file n_str.c.
References __n_assert, Free, LOG_DEBUG, LOG_ERR, Malloc, and n_log.
Referenced by str_to_long_long().
Here is the caller graph for this function:Copy from start to dest until from[ iterator ] == split.
| from | Source string |
| to | Dest string |
| to_size | the maximum size to write |
| split | stopping character |
| it | Save of iterator |
Definition at line 838 of file n_str.c.
References __n_assert, LOG_DEBUG, n_log, and split().
Here is the call graph for this function:| int strlo | ( | char * | string, |
| char * | dest | ||
| ) |
Upper case a string.
| string | the string to change to lower case |
| dest | the string where storing result |
Definition at line 817 of file n_str.c.
References __n_assert.
| int strup | ( | char * | string, |
| char * | dest | ||
| ) |
Upper case a string.
| string | the string to change to upper case |
| dest | the string where storing result |
Definition at line 798 of file n_str.c.
References __n_assert.
| char * trim | ( | char * | s | ) |
trim and put a \0 at the end, return new char *
| s | The string to trim |
Definition at line 131 of file n_str.c.
References __n_assert, and trim_nocopy().
Here is the call graph for this function:| char * trim_nocopy | ( | char * | s | ) |
trim and zero end the string, WARNING: keep and original pointer to delete the string correctly
| s | The string to trim |
Definition at line 102 of file n_str.c.
References __n_assert.
Referenced by load_config_file(), and trim().
Here is the caller graph for this function:| int wildmat | ( | register const char * | text, |
| register const char * | p | ||
| ) |
Written by Rich Salz rsalz at osf.org, refurbished by me.
Wildcard pattern matching .
| text | The source text to search |
| p | The text to search, with wildcards |
Definition at line 1211 of file n_str.c.
References wildmat(), WILDMAT_ABORT, and WILDMAT_NEGATE_CLASS.
Referenced by wildmat().
Here is the call graph for this function:
Here is the caller graph for this function:| int wildmatcase | ( | register const char * | text, |
| register const char * | p | ||
| ) |
Written by Rich Salz rsalz at osf.org, refurbished by me.
Wildcard pattern matching case insensitive.
| text | The source text to search |
| p | The text to search, with wildcards |
Definition at line 1275 of file n_str.c.
References WILDMAT_ABORT, WILDMAT_NEGATE_CLASS, and wildmatcase().
Referenced by scan_dir_ex(), and wildmatcase().
Here is the call graph for this function:
Here is the caller graph for this function:concatenate a copy of src of size strlen( src ) to dest, starting at dest[ written ], updating written and size variable, allocation of new blocks of (needed size + 512) if resize is needed.
If dest is NULL it will be allocated.
| dest | The dest string |
| size | The current size, will be updated if written + strlen( dest) > size |
| written | the number of octet added |
| src | The source string to add |
Definition at line 1126 of file n_str.c.
References write_and_fit_ex().
Referenced by main().
Here is the call graph for this function:
Here is the caller graph for this function:| int write_and_fit_ex | ( | char ** | dest, |
| NSTRBYTE * | size, | ||
| NSTRBYTE * | written, | ||
| const char * | src, | ||
| NSTRBYTE | src_size, | ||
| NSTRBYTE | additional_padding | ||
| ) |
concatenate a copy of src of size src_size to dest, starting at dest[ written ], updating written and size variable, allocation of new blocks of (needed size + additional_padding ) if resize is needed.
If dest is NULL it will be allocated.
| dest | The dest string |
| size | The current size, will be updated if written + strlen( dest) > size |
| written | the number of octet added |
| src | The source string to add |
| src_size | The source string size |
| additional_padding | In case the destination is reallocated, number of additional bytes that will be added (provisionning) |
Definition at line 1093 of file n_str.c.
References LOG_ERR, n_log, and Reallocz.
Referenced by main(), and write_and_fit().
Here is the caller graph for this function: