diff options
Diffstat (limited to 'src/server_set.c')
-rw-r--r-- | src/server_set.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/server_set.c b/src/server_set.c index 9b04f33..0e9252e 100644 --- a/src/server_set.c +++ b/src/server_set.c @@ -19,12 +19,24 @@ */ #include <stdlib.h> +#include <assert.h> #include "string_functions.h" +/* + * Function name: set_value + * Description: If the variable has no value, set it from the given string. + * If the given string is NULL, use default value. + * Arguments: dest - the destination variable + * from - the given string + * def - the default value + */ + void set_value(char** dest, char* from, char* def) { + assert(dest != NULL); + if ((*dest) == NULL) { if (from != NULL) { string_cp(dest, from); |