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) ...@@ -1071,6 +1071,8 @@ ccf_ban_list(struct cli *cli, const char * const *av, void *priv)
b->flags & BAN_F_GONE ? "G" : " "); b->flags & BAN_F_GONE ? "G" : " ");
ban_render(cli, b->spec); ban_render(cli, b->spec);
VCLI_Out(cli, "\n"); VCLI_Out(cli, "\n");
if (VCLI_Overflow(cli))
break;
if (cache_param->diag_bitmap & 0x80000) { if (cache_param->diag_bitmap & 0x80000) {
Lck_Lock(&ban_mtx); Lck_Lock(&ban_mtx);
struct objcore *oc; struct objcore *oc;
......
...@@ -52,6 +52,7 @@ struct cli_proto { ...@@ -52,6 +52,7 @@ struct cli_proto {
}; };
/* The implementation must provide these functions */ /* The implementation must provide these functions */
int VCLI_Overflow(struct cli *cli);
void VCLI_Out(struct cli *cli, const char *fmt, ...); void VCLI_Out(struct cli *cli, const char *fmt, ...);
void VCLI_Quote(struct cli *cli, const char *str); void VCLI_Quote(struct cli *cli, const char *str);
void VCLI_SetResult(struct cli *cli, unsigned r); void VCLI_SetResult(struct cli *cli, unsigned r);
...@@ -69,6 +69,17 @@ VCLI_Out(struct cli *cli, const char *fmt, ...) ...@@ -69,6 +69,17 @@ VCLI_Out(struct cli *cli, const char *fmt, ...)
va_end(ap); 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 */ /*lint -e{818} cli could be const */
void void
VCLI_Quote(struct cli *cli, const char *s) 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