va_end(args);
}
+int sr_log(void *cb_data, int loglevel, const char *format, va_list args)
+{
+ (void)cb_data;
+
+ if (loglevel == SR_LOG_ERR || loglevel == SR_LOG_WARN)
+ logmsg("Error: sr: ", stderr, format, args);
+ else if (debug)
+ logmsg("DBG: sr: ", stdout, format, args);
+
+ return SRD_OK;
+}
+
int srd_log(void *cb_data, int loglevel, const char *format, va_list args)
{
(void)cb_data;
if (loglevel == SRD_LOG_ERR || loglevel == SRD_LOG_WARN)
logmsg("Error: srd: ", stderr, format, args);
- else if (loglevel >= SRD_LOG_DBG && debug)
+ else if (debug)
logmsg("DBG: srd: ", stdout, format, args);
return SRD_OK;
struct option *option;
GVariant *gvar;
GHashTable *probes, *opts;
- GSList *pdl, *l, *annl;
+ GSList *pdl, *l;
int idx;
- char **dec_ann;
+ char **decoder_class;
if (op->outfile) {
if ((op->outfd = open(op->outfile, O_CREAT|O_WRONLY, 0600)) == -1) {
dec = srd_decoder_get_by_id(pd->name);
if (op->class) {
if (op->type == SRD_OUTPUT_ANN)
- annl = dec->annotations;
- /* TODO can't dereference this for binary yet
+ l = dec->annotations;
else if (op->type == SRD_OUTPUT_BINARY)
- annl = dec->binary;
- */
+ l = dec->binary;
else
/* Only annotations and binary for now. */
return FALSE;
idx = 0;
- while(annl) {
- dec_ann = annl->data;
- /* TODO can't dereference this for binary yet */
- if (!strcmp(dec_ann[0], op->class)) {
+ while(l) {
+ decoder_class = l->data;
+ if (!strcmp(decoder_class[0], op->class)) {
op->class_idx = idx;
break;
} else
idx++;
- annl = annl->next;
+ l = l->next;
}
if (op->class_idx == -1) {
ERR("Output class '%s' not found in decoder %s.",
struct probe *probe;
struct option *option;
struct output *op;
+ int ret;
char c, *opt_infile, **kv, **opstr;
op = malloc(sizeof(struct output));
if (!op->pd || op->type == -1)
usage(NULL);
+ sr_log_callback_set(sr_log, NULL);
if (sr_init(&ctx) != SR_OK)
return 1;
if (srd_init(DECODERS_DIR) != SRD_OK)
return 1;
- run_testcase(opt_infile, pdlist, op);
+ ret = 0;
+ if (!run_testcase(opt_infile, pdlist, op))
+ ret = 1;
srd_exit();
sr_exit(ctx);
- return 0;
+ return ret;
}