aboutsummaryrefslogtreecommitdiff
path: root/include/sg_pr2serr.h
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2022-06-27 18:26:54 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2022-06-27 18:26:54 +0000
commit30842a3103045e471ec8169f09135bb6766e5e1d (patch)
treea37d6d0bc773726fff04c163457d3bb22e6efa71 /include/sg_pr2serr.h
parent2e225c87784735360e9619766efe06782179a86a (diff)
downloadsg3_utils-30842a3103045e471ec8169f09135bb6766e5e1d.tar.gz
more JSON work: sense data and vpd device id, start on sg_vpd
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@956 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'include/sg_pr2serr.h')
-rw-r--r--include/sg_pr2serr.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/sg_pr2serr.h b/include/sg_pr2serr.h
index 9a1fd273..1577b6ce 100644
--- a/include/sg_pr2serr.h
+++ b/include/sg_pr2serr.h
@@ -153,6 +153,9 @@ sgj_opaque_p sgj_new_named_array(sgj_state * jsp, sgj_opaque_p jop,
* a pointer newly formed JSON string. */
sgj_opaque_p sgj_add_nv_s(sgj_state * jsp, sgj_opaque_p jop,
const char * name, const char * value);
+sgj_opaque_p sgj_add_nv_s_len(sgj_state * jsp, sgj_opaque_p jop,
+ const char * name,
+ const char * value, int slen);
/* If either jsp is NULL or jsp->pr_as_json is false then nothing happens and
* NULL is returned. The insertion point is at jop but if it is NULL
@@ -256,6 +259,12 @@ void sgj_add_nv_ihexstr_ane(sgj_state * jsp, sgj_opaque_p jop,
const char * str_name, const char * val_s,
const char * ane_s);
+/* Breaks up the string pointed to by 'sp' into lines and adds them to the
+ * jsp->outputp array. Treat '\n' in sp as line breaks. Consumes characters
+ * from sp until either a '\0' is found or slen is exhausted. Add each line
+ * to jsp->outputp JSON array (if conditions met). */
+void sgj_pr_str_output(sgj_state * jsp, const char * sp, int slen);
+
/* This function only produces JSON output if jsp is non-NULL and
* jsp->pr_as_json is true. 'sbp' is assumed to point to sense data as
* defined by T10 with a length of 'sb_len' bytes. Returns false if an
@@ -287,6 +296,8 @@ void sgj_free_unattached(sgj_opaque_p jop);
* jsp->userp will all be set to NULL. */
void sgj_finish(sgj_state * jsp);
+char * sg_json_usage(int char_if_not_j, char * b, int blen);
+
#ifdef __cplusplus
}