summaryrefslogtreecommitdiffstats
path: root/contrib/libucl/utils
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2014-07-19 23:44:57 +0000
committerbapt <bapt@FreeBSD.org>2014-07-19 23:44:57 +0000
commit6f718e3669e9ecc1b1ca407a465d6ee20571a2b8 (patch)
treeba71cc26671c93ed9809f7cadb07734c0bddb4c7 /contrib/libucl/utils
parent6095428430d025abcf6983536297f168bf62b45b (diff)
downloadFreeBSD-src-6f718e3669e9ecc1b1ca407a465d6ee20571a2b8.zip
FreeBSD-src-6f718e3669e9ecc1b1ca407a465d6ee20571a2b8.tar.gz
MFC: r263648, r264789, r266636
This brings: - schema validation - xpath-like interface for ucl objects Adapt pkg(7) to the new libucl API
Diffstat (limited to 'contrib/libucl/utils')
-rw-r--r--contrib/libucl/utils/Makefile.am19
-rw-r--r--contrib/libucl/utils/objdump.c10
2 files changed, 24 insertions, 5 deletions
diff --git a/contrib/libucl/utils/Makefile.am b/contrib/libucl/utils/Makefile.am
new file mode 100644
index 0000000..61e06a7
--- /dev/null
+++ b/contrib/libucl/utils/Makefile.am
@@ -0,0 +1,19 @@
+common_utils_cflags = -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/uthash
+common_utils_ldadd = $(top_builddir)/src/libucl.la
+
+ucl_chargen_SOURCES = chargen.c
+ucl_chargen_LDADD = $(common_utils_ldadd)
+ucl_chargen_CFLAGS = $(common_utils_cflags)
+
+ucl_objdump_SOURCES = objdump.c
+ucl_objdump_LDADD = $(common_utils_ldadd)
+ucl_objdump_CFLAGS = $(common_utils_cflags)
+
+if UTILS
+UTL = ucl_chargen ucl_objdump
+else
+UTL =
+endif
+bin_PROGRAMS = $(UTL) \ No newline at end of file
diff --git a/contrib/libucl/utils/objdump.c b/contrib/libucl/utils/objdump.c
index 8bf6e28..2e00d0a 100644
--- a/contrib/libucl/utils/objdump.c
+++ b/contrib/libucl/utils/objdump.c
@@ -28,11 +28,11 @@
#include "ucl.h"
void
-ucl_obj_dump(ucl_object_t *obj, unsigned int shift)
+ucl_obj_dump (const ucl_object_t *obj, unsigned int shift)
{
int num = shift * 4 + 5;
char *pre = (char *) malloc (num * sizeof(char));
- ucl_object_t *cur, *tmp;
+ const ucl_object_t *cur, *tmp;
ucl_object_iter_t it = NULL, it_obj = NULL;
pre[--num] = 0x00;
@@ -64,7 +64,7 @@ ucl_obj_dump(ucl_object_t *obj, unsigned int shift)
}
else if (obj->type == UCL_INT) {
printf ("%stype: UCL_INT\n", pre);
- printf ("%svalue: %ld\n", pre, ucl_object_toint (obj));
+ printf ("%svalue: %jd\n", pre, (intmax_t)ucl_object_toint (obj));
}
else if (obj->type == UCL_FLOAT) {
printf ("%stype: UCL_FLOAT\n", pre);
@@ -99,7 +99,7 @@ main(int argc, char **argv)
struct ucl_parser *parser;
int k, ret = 0, r = 0;
ucl_object_t *obj = NULL;
- ucl_object_t *par;
+ const ucl_object_t *par;
FILE *in;
if (argc > 1) {
@@ -129,7 +129,7 @@ main(int argc, char **argv)
}
obj = ucl_parser_get_object (parser);
- if (ucl_parser_get_error(parser)) {
+ if (ucl_parser_get_error (parser)) {
printf ("Error occured: %s\n", ucl_parser_get_error(parser));
ret = 1;
goto end;
OpenPOWER on IntegriCloud