Commit 9857918c authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add VCLI_Overflow() so we can stop rendering bans when the CLI

output buffer is full.
parent ccf9f85a
......@@ -1071,6 +1071,8 @@ ccf_ban_list(struct cli *cli, const char * const *av, void *priv)
b->flags & BAN_F_GONE ? "G" : " ");
ban_render(cli, b->spec);
VCLI_Out(cli, "\n");
if (VCLI_Overflow(cli))
break;
if (cache_param->diag_bitmap & 0x80000) {
Lck_Lock(&ban_mtx);
struct objcore *oc;
......
......@@ -52,6 +52,7 @@ struct cli_proto {
};
/* The implementation must provide these functions */
int VCLI_Overflow(struct cli *cli);
void VCLI_Out(struct cli *cli, const char *fmt, ...);
void VCLI_Quote(struct cli *cli, const char *str);
void VCLI_SetResult(struct cli *cli, unsigned r);
......@@ -69,6 +69,17 @@ VCLI_Out(struct cli *cli, const char *fmt, ...)
va_end(ap);
}
/*lint -e{818} cli could be const */
int
VCLI_Overflow(struct cli *cli)
{
CHECK_OBJ_NOTNULL(cli, CLI_MAGIC);
if (cli->result == CLIS_TRUNCATED ||
VSB_len(cli->sb) >= *cli->limit)
return (1);
return (0);
}
/*lint -e{818} cli could be const */
void
VCLI_Quote(struct cli *cli, const char *s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment