mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
session: process environment.d and allow empty variables
1. All '*.env' files in an 'environment.d' directory alongside each potential 'environment' file will be parsed and added to the environment. 2. For the purposes of configuration merging, an environment definition exists at one level if either the 'environment' file is defined or its corresponding 'environment.d' contains any valid '*.env' file. 3. Variable declarations of the form "VARIABLE=", with no following value, will be written to the environment as empty strings.
This commit is contained in:
parent
52cb643189
commit
e837445114
4 changed files with 121 additions and 10 deletions
|
|
@ -86,7 +86,7 @@ strdup_printf(const char *fmt, ...)
|
|||
}
|
||||
|
||||
char *
|
||||
str_join(const char * const parts[],
|
||||
str_join(const char *const parts[],
|
||||
const char *restrict fmt, const char *restrict sep)
|
||||
{
|
||||
assert(parts);
|
||||
|
|
@ -154,3 +154,19 @@ str_join(const char * const parts[],
|
|||
return buf;
|
||||
}
|
||||
|
||||
bool
|
||||
str_endswith(const char *const string, const char *const suffix)
|
||||
{
|
||||
size_t len_str = string ? strlen(string) : 0;
|
||||
size_t len_sfx = suffix ? strlen(suffix) : 0;
|
||||
|
||||
if (len_str < len_sfx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (len_sfx == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return strcmp(string + len_str - len_sfx, suffix) == 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue