From: Eric Bollengier Date: Mon, 31 Oct 2022 14:52:13 +0000 (+0100) Subject: Add set_limit_offset() to OutputWriter groups X-Git-Tag: Beta-15.0.0~380 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4d981b1d9f48d78fe865aa052910e4848a7e499;p=thirdparty%2Fbacula.git Add set_limit_offset() to OutputWriter groups --- diff --git a/bacula/src/lib/output.c b/bacula/src/lib/output.c index 2f119bf08..35bfc66cc 100644 --- a/bacula/src/lib/output.c +++ b/bacula/src/lib/output.c @@ -198,6 +198,12 @@ char *OutputWriter::start_group(const char *name, bool append) char *OutputWriter::end_group(bool append) { get_buf(append); + if (limit >= 0) { + get_output(OT_SEP, OT_INT, "limit", limit, OT_END); + } + if (offset >= 0) { + get_output(OT_SEP, OT_INT, "offset", offset, OT_END); + } return get_output(OT_SEP, OT_INT32, "error", error, OT_STRING, "errmsg", NPRTB(errmsg), diff --git a/bacula/src/lib/output.h b/bacula/src/lib/output.h index 47de2faed..289d8e659 100644 --- a/bacula/src/lib/output.h +++ b/bacula/src/lib/output.h @@ -116,6 +116,8 @@ private: need_separator=false; will_need_separator=true; + limit = -1; // not set + offset = -1; // not set error = 0; errmsg = NULL; }; @@ -141,6 +143,8 @@ protected: const char *close_hash; const char *label; + int limit; + int offset; int error; char *errmsg; @@ -181,6 +185,10 @@ public: virtual char *start_list(const char *name, bool append=true); virtual char *end_list(bool append=true); + void set_limit_offset(int l, int o) { + limit = l; + offset = o; + }; void set_label(const char *l) { label = l; };