This enables to get realtime output from "lldpcli watch".
See #187.
JSON_INDENT(2) | JSON_PRESERVE_ORDER) == -1)
log_warnx("lldpctl", "unable to output JSON");
fprintf(p->fh,"\n");
+ fflush(p->fh);
json_decref(export);
json_decref(root->el);
root->el = json_object();
int json_flags = (JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED);
const char *s = json_object_to_json_string_ext(export, json_flags);
fprintf(p->fh, "%s\n", s?s:"{}");
+ fflush(p->fh);
json_object_put(export);
json_object_put(root->el);
root->el = json_object_new_object();
struct kv_writer_private *p = w->priv;
char *dot;
- if ((dot = strrchr(p->prefix, '\1')) == NULL)
+ if ((dot = strrchr(p->prefix, '\1')) == NULL) {
p->prefix[0] = '\0';
- else
+ fflush(p->fh);
+ } else
*dot = '\0';
}
struct txt_writer_private *p = w->priv;
p->level--;
- if (p->level == 1)
+ if (p->level == 1) {
fprintf(p->fh, "\n%s", sep);
+ fflush(p->fh);
+ }
}
static void
}
xmlFreeTextWriter(p->xw);
- if (!failed)
+ if (!failed) {
xmlDocDump(p->fh, p->doc);
+ fflush(p->fh);
+ }
xmlFreeDoc(p->doc);
}
}