]> sigrok.org Git - libsigrok.git/blobdiff - strutil.c
Add missing #includes to avoid clang warnings.
[libsigrok.git] / strutil.c
index 8b0203b01765cd06ff8fb35b07fb0df0309f0a1c..380d78f59efdbb0bf72009c903484a85d9f87a06 100644 (file)
--- a/strutil.c
+++ b/strutil.c
@@ -144,7 +144,7 @@ char **sr_parse_triggerstring(struct sr_device *device,
                }
 
                if (probenum < 1 || probenum > max_probes) {
-                       printf("Invalid probe.\n");
+                       sr_err("Invalid probe.\n");
                        error = TRUE;
                        break;
                }
@@ -152,7 +152,7 @@ char **sr_parse_triggerstring(struct sr_device *device,
                if ((trigger = strchr(tokens[i], '='))) {
                        for (tc = ++trigger; *tc; tc++) {
                                if (strchr(trigger_types, *tc) == NULL) {
-                                       printf("Unsupported trigger type "
+                                       sr_err("Unsupported trigger type "
                                               "'%c'\n", *tc);
                                        error = TRUE;
                                        break;
@@ -267,3 +267,18 @@ uint64_t sr_parse_timestring(const char *timestring)
 
        return time_msec;
 }
+
+gboolean sr_parse_boolstring(const char *boolstr)
+{
+       if (!boolstr)
+               return FALSE;
+
+       if (!g_strcasecmp(boolstr, "true") || 
+           !g_strcasecmp(boolstr, "yes") ||
+           !g_strcasecmp(boolstr, "on") ||
+           !g_strcasecmp(boolstr, "1")) 
+               return TRUE;
+
+       return FALSE;
+}
+