From 3128de3f19e18c67626ba34523f6696b584c3f9e Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 20 Jun 2008 18:45:35 +0000 Subject: buffer-limit option. --- cmd-set-option.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'cmd-set-option.c') diff --git a/cmd-set-option.c b/cmd-set-option.c index b4b9ece0..501a94ff 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-option.c,v 1.33 2008-06-19 23:20:45 nicm Exp $ */ +/* $Id: cmd-set-option.c,v 1.34 2008-06-20 18:45:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -250,6 +250,24 @@ cmd_set_option_exec(struct cmd *self, unused struct cmd_ctx *ctx) return; } options_set_number(oo, "display-time", number); + } else if (strcmp(data->option, "buffer-limit") == 0) { + if (data->value == NULL || number == -1) { + ctx->error(ctx, "invalid value"); + return; + } + if (errstr != NULL) { + ctx->error(ctx, "buffer-limit %s", errstr); + return; + } + if (number == 0) { + ctx->error(ctx, "zero buffer-limit"); + return; + } + if (number > INT_MAX) { + ctx->error(ctx, "buffer-limit too big: %u", number); + return; + } + options_set_number(oo, "buffer-limit", number); } else if (strcmp(data->option, "status-left") == 0) { if (data->value == NULL) { ctx->error(ctx, "invalid value"); -- cgit