summaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2014-12-27 17:15:56 -0600
committerNicolas Williams <nico@cryptonector.com>2015-01-14 01:39:13 -0600
commitaeb52e29d63aba1097dc9c39eff8c0fb91b09484 (patch)
treeb8cdd81ab8df4ab39e71a64a16ba389d1eb202c3 /builtin.c
parent97602456e32487d5fe5f7ecff3a0fddee8882d87 (diff)
Add `debug` and `stderr` builtins
And refactor setup of jv dump flags.
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin.c b/builtin.c
index a9c64d8e..1722de78 100644
--- a/builtin.c
+++ b/builtin.c
@@ -903,6 +903,12 @@ static jv f_debug(jq_state *jq, jv input) {
return input;
}
+static jv f_stderr(jq_state *jq, jv input) {
+ jv_dumpf(jv_copy(input), stderr, 0);
+ fprintf(stderr, "\n");
+ return input;
+}
+
#define LIBM_DD(name) \
{(cfunction_ptr)f_ ## name, "_" #name, 1},
@@ -959,6 +965,7 @@ static const struct cfunction function_list[] = {
{(cfunction_ptr)f_modulemeta, "modulemeta", 1},
{(cfunction_ptr)f_input, "_input", 1},
{(cfunction_ptr)f_debug, "debug", 1},
+ {(cfunction_ptr)f_stderr, "stderr", 1},
};
#undef LIBM_DD