diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-09-04 00:27:36 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-09-04 00:27:36 +0000 |
commit | 57e473b61cf373f8d9befb03d359b999eca4262b (patch) | |
tree | 0c4d0798db9c4ecf4804aaaff60e9fe8b30ac0f6 /polyp/modargs.c | |
parent | fb962b67dbeb54d1cdd453c6f902b7c679b9197f (diff) |
add support for automatic termination of the daemon after the last client quit
remove all gcc warnings
add boolean types for tagstruct and modargs
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@178 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/modargs.c')
-rw-r--r-- | polyp/modargs.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/polyp/modargs.c b/polyp/modargs.c index 87d99ad2..4874d808 100644 --- a/polyp/modargs.c +++ b/polyp/modargs.c @@ -207,6 +207,46 @@ int pa_modargs_get_value_u32(struct pa_modargs *ma, const char *key, uint32_t *v return 0; } +int pa_modargs_get_value_s32(struct pa_modargs *ma, const char *key, int32_t *value) { + const char *v; + char *e; + signed long l; + assert(ma && key && value); + + if (!(v = pa_modargs_get_value(ma, key, NULL))) + return 0; + + if (!*v) + return -1; + + l = strtol(v, &e, 0); + if (*e) + return -1; + + *value = (int32_t) l; + return 0; +} + +int pa_modargs_get_value_boolean(struct pa_modargs *ma, const char *key, int *value) { + const char *v; + assert(ma && key && value); + + if (!(v = pa_modargs_get_value(ma, key, NULL))) + return 0; + + if (!*v) + return -1; + + if (!strcmp(v, "1") || !strcasecmp(v, "yes") || !strcasecmp(v, "y") || !strcasecmp(v, "on")) + *value = 1; + else if (!strcmp(v, "0") || !strcasecmp(v, "no") || !strcasecmp(v, "n") || !strcasecmp(v, "off")) + *value = 0; + else + return -1; + + return 0; +} + int pa_modargs_get_sample_spec(struct pa_modargs *ma, struct pa_sample_spec *rss) { const char *format; uint32_t channels; |