summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2015-02-05 13:19:19 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2015-02-05 13:19:19 +0100
commitb06460c9f55a41143955c7b881afdafe673f8536 (patch)
tree3be2befc88abbffd13566e5a983ec934d3804980
parente7948a1c2737d20b46b4665820042360b0cf557b (diff)
downloadratpoison-b06460c9f55a41143955c7b881afdafe673f8536.zip
Be more strict about what "dedicate" accepts
No argument or... either 0 or 1. Will perhaps make debugging easier.
-rw-r--r--src/actions.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/actions.c b/src/actions.c
index 7579101..725b3d8 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -5965,12 +5965,20 @@ cmd_dedicate (int interactive UNUSED, struct cmdarg **args)
{
rp_frame *f;
- f = current_frame();
- if (!f) return cmdret_new (RET_SUCCESS, NULL);
+ f = current_frame ();
+ if (f == NULL)
+ return cmdret_new (RET_SUCCESS, NULL);
- if (args[0])
- /* Whatever you set it to. */
- f->dedicated = ARG(0,number);
+ if (args[0] != NULL)
+ {
+ int dedicated;
+
+ dedicated = ARG (0, number);
+ if (dedicated != 0 && dedicated != 1)
+ return cmdret_new (RET_FAILURE,
+ "Invalid \"dedicate\" value, use 0 or 1.");
+ f->dedicated = dedicated;
+ }
else
/* Just toggle it, rather than on or off. */
f->dedicated = !(f->dedicated);