X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=parsers.c;h=5ec655f78ad3dce8a05f01186a2a7ec61febb437;hb=adf8d7a9de5da50b7ee9c9d601c0258c830b38f0;hp=35545e02e7d59d3080fc36b98486d02491fd08a2;hpb=24bd9719166584e3b4e6e6423d6d6bcbc1a88251;p=sigrok-cli.git
diff --git a/parsers.c b/parsers.c
index 35545e0..5ec655f 100644
--- a/parsers.c
+++ b/parsers.c
@@ -17,14 +17,13 @@
* along with this program. If not, see .
*/
-#include "sigrok-cli.h"
+#include
#include
#include
#include
#include
#include
-
-extern struct sr_context *sr_ctx;
+#include "sigrok-cli.h"
struct sr_channel *find_channel(GSList *channellist, const char *channelname)
{
@@ -67,10 +66,12 @@ GSList *parse_channelstring(struct sr_dev_inst *sdi, const char *channelstring)
break;
}
if (strchr(tokens[i], '-')) {
- /* A range of channels in the form a-b. This will only work
+ /*
+ * A range of channels in the form a-b. This will only work
* if the channels are named as numbers -- so every channel
* in the range must exist as a channel name string in the
- * device. */
+ * device.
+ */
range = g_strsplit(tokens[i], "-", 2);
if (!range[0] || !range[1] || range[2]) {
/* Need exactly two arguments. */
@@ -408,12 +409,15 @@ int parse_driver(char *arg, struct sr_dev_driver **driver, GSList **drvopts)
int i;
char *drvname;
+ if (!arg)
+ return FALSE;
+
drvargs = parse_generic_arg(arg, TRUE);
drvname = g_strdup(g_hash_table_lookup(drvargs, "sigrok_key"));
g_hash_table_remove(drvargs, "sigrok_key");
*driver = NULL;
- drivers = sr_driver_list();
+ drivers = sr_driver_list(sr_ctx);
for (i = 0; drivers[i]; i++) {
if (strcmp(drivers[i]->name, drvname))
continue;
@@ -447,4 +451,3 @@ int parse_driver(char *arg, struct sr_dev_driver **driver, GSList **drvopts)
return TRUE;
}
-