Module: xenomai-3
Branch: next
Commit: f6f49bd8a3d2ba345524be63b20b9121f1fbe7b1
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f6f49bd8a3d2ba345524be63b20b9121f1fbe7b1

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Mar 26 16:27:07 2015 +0100

smokey: fix parsing of boolean args

---

 include/smokey/smokey.h |    1 +
 lib/smokey/helpers.c    |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/smokey/smokey.h b/include/smokey/smokey.h
index 545fb04..c5133fc 100644
--- a/include/smokey/smokey.h
+++ b/include/smokey/smokey.h
@@ -96,6 +96,7 @@ struct smokey_test {
 #define SMOKEY_ARG(__plugin, __arg)       (smokey_lookup_arg(&(__plugin), # 
__arg))
 #define SMOKEY_ARG_ISSET(__plugin, __arg)  (SMOKEY_ARG(__plugin, 
__arg)->matched)
 #define SMOKEY_ARG_INT(__plugin, __arg)           (SMOKEY_ARG(__plugin, 
__arg)->u.n_val)
+#define SMOKEY_ARG_BOOL(__plugin, __arg)   (!!SMOKEY_ARG_INT(__plugin, __arg))
 #define SMOKEY_ARG_STRING(__plugin, __arg) (SMOKEY_ARG(__plugin, 
__arg)->u.s_val)
 
 #ifdef __cplusplus
diff --git a/lib/smokey/helpers.c b/lib/smokey/helpers.c
index f653e53..49e2177 100644
--- a/lib/smokey/helpers.c
+++ b/lib/smokey/helpers.c
@@ -29,7 +29,7 @@ int smokey_int(const char *s, struct smokey_arg *arg)
        char *name, *p;
        int ret;
 
-       ret = sscanf(s, "%m[a-z]=%m[^\n]", &name, &p);
+       ret = sscanf(s, "%m[_a-z]=%m[^\n]", &name, &p);
        if (ret != 2 || !(isdigit(*p) || *p == '-'))
                return 0;
 
@@ -66,7 +66,7 @@ int smokey_string(const char *s, struct smokey_arg *arg)
        char *name, *p;
        int ret;
 
-       ret = sscanf(s, "%m[a-z]=%m[^\n]", &name, &p);
+       ret = sscanf(s, "%m[_a-z]=%m[^\n]", &name, &p);
        if (ret != 2)
                return 0;
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to