Commit graph

93 commits

Author SHA1 Message Date
Jo-Philipp Wich
592f2dbd82 sh/jshn.sh: allow numbers in identifiers for json_get_var()
When traversing arrays of tables or arrays of array it is required to
call json_select # where # is the index of the array item to select.

Internally json_select() calls json_get_var() to obtain the correct
prefix to populate $JSON_CUR with. However, the "tr" call in
json_get_var() incorrectly replaces all digits with underscores,
making any lookup for numeric array items fail.

The attached patch changes the "tr" expression to allow digits and
thus implements the expected behaviour for nested arrays.
2012-05-16 10:42:37 +02:00
Felix Fietkau
97ed91fa77 jshn.sh: add json_get_vars() wrapper function 2012-05-14 00:21:12 +02:00
Felix Fietkau
f8d3e57b45 add blobmsg_add_blob() to copy over an existing blobmsg attribute 2012-05-08 15:59:19 +02:00
Felix Fietkau
b1ea9afd60 remove uhtbl-test.c, it is obsolete 2012-03-14 11:55:59 +01:00
Felix Fietkau
92da3a9bcc replace list.h with a BSD licensed variant (taken from FreeBSD SVN) 2012-02-06 21:09:51 +01:00
Felix Fietkau
f565a7af42 blobmsg: add missing endian conversions 2011-11-17 00:47:54 +01:00
Felix Fietkau
5ce9b8912f blobmsg_json: print int16 elements in blobmsg_format_element (patch by Luka Perkov) 2011-11-17 00:40:37 +01:00
Felix Fietkau
a654d2f42b blob: switch to ISC license, switch blob_{get,put}_int* to _u*, add wrappers 2011-11-10 09:05:33 +01:00
Felix Fietkau
fc20c7a031 make casts from void * explicit to avoid C++ warnings (patch by Arthur Davis) 2011-10-27 10:16:56 +02:00
Felix Fietkau
01c6f73ed7 list.h: rename parameter named "new" to "_new" to avoid using a reserved C++ keyword (patch by Arthur Davis) 2011-10-27 10:16:09 +02:00
Felix Fietkau
51711be625 fix more instances of uninitialized padding bytes 2011-10-06 17:57:13 +02:00
Felix Fietkau
7c80b7c514 blobmsg: fill padding between name and data 2011-10-06 17:19:28 +02:00
Felix Fietkau
08aada9a93 make the blobmsg format endian agnostic (stick to big-endian) 2011-10-06 17:15:00 +02:00
Felix Fietkau
309d7d456f fill padding bytes when setting raw attribute length 2011-10-06 17:14:44 +02:00
Felix Fietkau
f24324c27f explicitly zero extra buffer space added with realloc to silence valgrind warnings 2011-10-03 12:41:51 +02:00
Felix Fietkau
591a1e349f fix reads beyond the end of the buffer when iterating over blob attributes 2011-10-03 12:36:46 +02:00
Felix Fietkau
8cada85b61 add a blobmsg_type() inline function 2011-09-12 13:37:53 +02:00
Felix Fietkau
738884e746 same for json_get_var 2011-09-11 11:46:44 +02:00
Felix Fietkau
a1a97eb11e jshn: support using characters in elements that do not conform to shell variable restrictions 2011-09-11 11:40:22 +02:00
Felix Fietkau
dee81b4f79 add blobmsg_get_bool 2011-09-07 06:33:36 +02:00
Felix Fietkau
34a6d05f9a blob_attr_equal: un-inline, add pointer checks 2011-09-05 06:25:51 +02:00
Felix Fietkau
b1c320132e add blob_attr_equal() for comparing attributes 2011-09-05 06:09:32 +02:00
Felix Fietkau
1d3e4ccb6a fix a bug in blobmsg_parse
a second entry that has the same length as an existing found entry would
abort the parse loop (reported by Stefan Mächler)
2011-08-17 10:44:11 -07:00
Felix Fietkau
f1a44355bd change the include path for list.h in jshn.c 2011-08-12 11:12:50 -06:00
Felix Fietkau
d6ebb84ad6 add a missing include 2011-08-11 15:37:48 -06:00
Felix Fietkau
ec56b91662 jshn: clear more variables on json_init, fix adding array elements 2011-08-11 15:29:23 -06:00
Felix Fietkau
bdf717425a add blob_buf_free 2011-07-29 19:38:30 +02:00
Felix Fietkau
abbc140e8d add BLOBMSG_TYPE_BOOL as an alias for BLOBMSG_TYPE_INT8 2011-07-29 12:56:48 +02:00
Felix Fietkau
ed9b5c986b blobmsg_json: support indenting of output data 2011-07-18 13:04:23 +02:00
Felix Fietkau
bdf6363777 jshn: add an option for printing the json data without a terminating newline 2011-05-31 15:41:19 +02:00
Felix Fietkau
a8032be64c uloop: use list.h, add support for handling sigchld 2011-05-24 22:12:17 +02:00
Felix Fietkau
11079ba582 jshn: fix invalid variable reuse 2011-05-23 23:15:33 +02:00
Felix Fietkau
cc2457aa3e jshn: do not use -n on export 2011-05-23 23:09:19 +02:00
Felix Fietkau
fda6079b30 add jshn 2011-05-23 22:21:27 +02:00
Felix Fietkau
3041e8ce9b make the avl node key const 2011-04-13 20:14:20 +02:00
Felix Fietkau
89122a2c1e remove int16, use int8 as bool instead of integer 2011-03-27 01:08:51 +01:00
Felix Fietkau
a7c9ae6d6a support building without json support 2011-03-26 23:50:33 +01:00
Felix Fietkau
f213e8b432 remove the hlist code 2011-03-26 20:38:33 +01:00
Felix Fietkau
dc8c37fa8b change minimum cmake version to 2.6 2011-02-12 23:58:09 +01:00
Felix Fietkau
9abfbad95f uloop: fix event timeouts on darwin 2011-02-12 21:33:32 +01:00
Felix Fietkau
83037e345d uloop: allow timeouts to cancel the event loop 2011-02-11 02:38:36 +01:00
Felix Fietkau
7ec33884a3 allow multiple calls to uloop_init() without annoying side effects 2011-02-11 01:25:37 +01:00
Felix Fietkau
1ef7c81dfc add a cast to fix 64 bit issues 2011-02-07 20:30:52 +01:00
Felix Fietkau
e44dbfb102 uloop: make first_timeout static 2011-02-07 17:52:33 +01:00
Felix Fietkau
db19e64c1a make uloop_end() inline 2011-02-07 17:51:20 +01:00
Felix Fietkau
81839e259a validate blobmsg attributes before converting them to json 2011-02-07 17:47:02 +01:00
Felix Fietkau
07dbea0058 usock: remove code duplication 2011-02-07 17:38:05 +01:00
Felix Fietkau
a5e2b50652 properly null-terminate formatted json strings 2011-02-07 01:18:56 +01:00
Felix Fietkau
6bbde6e647 allow blobmsg_add_field to add arrays/tables 2011-02-07 01:12:07 +01:00
Felix Fietkau
932914c1b1 rename blob_get_int* to blob_get_u* 2011-02-06 21:36:04 +01:00