|
OpenVPN
|
#include <string.h>#include <ctype.h>#include <stdbool.h>#include <stdlib.h>#include <sys/types.h>#include <stdint.h>#include "utils.h"
Go to the source code of this file.
Functions | |
| char * | searchandreplace (const char *tosearch, const char *searchfor, const char *replacewith) |
| Read 'tosearch', replace all occurrences of 'searchfor' with 'replacewith' and return a pointer to the NEW string. | |
| const char * | get_env (const char *name, const char *envp[]) |
| Given an environmental variable name, search the envp array for its value. | |
| int | string_array_len (const char *array[]) |
| Return the length of a string array. | |
| const char * get_env | ( | const char * | name, |
| const char * | envp[] | ||
| ) |
Given an environmental variable name, search the envp array for its value.
| name | Environment variable to look up |
| envp | Environment variable table with all key/value pairs |
Definition at line 92 of file utils.c.
References i.
| char * searchandreplace | ( | const char * | tosearch, |
| const char * | searchfor, | ||
| const char * | replacewith | ||
| ) |
Read 'tosearch', replace all occurrences of 'searchfor' with 'replacewith' and return a pointer to the NEW string.
Does not modify the input strings. Will not enter an infinite loop with clever 'searchfor' and 'replacewith' strings.
| tosearch | haystack to search in |
| searchfor | needle to search for in the haystack |
| replacewith | when a match is found, replace needle with this string |
Definition at line 42 of file utils.c.
Referenced by my_conv(), pass_any_empty_string__returns_null(), pass_any_null_param__returns_null(), pattern_not_found__returns_original(), replace_longer_text__multiple_times__match_all_matches_are_replaced(), replace_single_char__multiple_times__match_all_matches_are_replaced(), and replace_single_char__one_time__match_is_replaced().