diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-02-13 18:06:30 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-02-13 18:06:30 +0100 |
commit | f863756b430bed8cd43c31535eda5d973abbc1b1 (patch) | |
tree | 609dff24cfd54798a52af36bb250ae04fbb97698 /src | |
parent | 689e6f8a811e9fb00928bc57f2acbb859ac3923a (diff) |
make PULSE_PROP env vars non-overriding but introduce PULSE_PROP_OVERRIDE for allowing overriding
Diffstat (limited to 'src')
-rw-r--r-- | src/pulsecore/proplist-util.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c index 8a447cf7..ae8e0802 100644 --- a/src/pulsecore/proplist-util.c +++ b/src/pulsecore/proplist-util.c @@ -58,18 +58,27 @@ void pa_init_proplist(pa_proplist *p) { for (e = environ; *e; e++) { if (pa_startswith(*e, "PULSE_PROP_")) { - size_t kl = strcspn(*e+11, "="); + size_t kl, skip; char *k; + pa_bool_t override; - if ((*e)[11+kl] != '=') - continue; + if (pa_startswith(*e, "PULSE_PROP_OVERRIDE_")) { + skip = 20; + override = TRUE; + } else { + skip = 11; + override = FALSE; + } + + kl = strcspn(*e+skip, "="); - if (!pa_utf8_valid(*e+11+kl+1)) + if ((*e)[skip+kl] != '=') continue; - k = pa_xstrndup(*e+11, kl); + k = pa_xstrndup(*e+skip, kl); - pa_proplist_sets(p, k, *e+11+kl+1); + if (override || !pa_proplist_contains(p, k)) + pa_proplist_sets(p, k, *e+skip+kl+1); pa_xfree(k); } } @@ -79,6 +88,15 @@ void pa_init_proplist(pa_proplist *p) { pa_proplist *t; if ((t = pa_proplist_from_string(pp))) { + pa_proplist_update(p, PA_UPDATE_MERGE, t); + pa_proplist_free(t); + } + } + + if ((pp = getenv("PULSE_PROP_OVERRIDE"))) { + pa_proplist *t; + + if ((t = pa_proplist_from_string(pp))) { pa_proplist_update(p, PA_UPDATE_REPLACE, t); pa_proplist_free(t); } |