aboutsummaryrefslogtreecommitdiff
path: root/options-cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'options-cmd.c')
-rw-r--r--options-cmd.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/options-cmd.c b/options-cmd.c
index b31754e7..2c1ab636 100644
--- a/options-cmd.c
+++ b/options-cmd.c
@@ -1,4 +1,4 @@
-/* $Id: options-cmd.c,v 1.3 2009-01-10 01:51:22 nicm Exp $ */
+/* $Id: options-cmd.c,v 1.4 2009-01-27 20:22:33 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -81,14 +81,14 @@ void
set_option_colour(struct cmd_ctx *ctx, struct options *oo,
const struct set_option_entry *entry, char *value)
{
- u_char colour;
+ int colour;
if (value == NULL) {
ctx->error(ctx, "empty value");
return;
}
- if ((colour = colour_fromstring(value)) > 8) {
+ if ((colour = colour_fromstring(value)) == -1) {
ctx->error(ctx, "bad colour: %s", value);
return;
}
@@ -99,6 +99,27 @@ set_option_colour(struct cmd_ctx *ctx, struct options *oo,
}
void
+set_option_attributes(struct cmd_ctx *ctx, struct options *oo,
+ const struct set_option_entry *entry, char *value)
+{
+ int attr;
+
+ if (value == NULL) {
+ ctx->error(ctx, "empty value");
+ return;
+ }
+
+ if ((attr = attributes_fromstring(value)) == -1) {
+ ctx->error(ctx, "bad attributes: %s", value);
+ return;
+ }
+
+ options_set_number(oo, entry->name, attr);
+ ctx->info(ctx,
+ "set option: %s -> %s", entry->name, attributes_tostring(attr));
+}
+
+void
set_option_flag(struct cmd_ctx *ctx, struct options *oo,
const struct set_option_entry *entry, char *value)
{