summaryrefslogtreecommitdiffstats
path: root/cmd-list.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-19 18:23:40 +0000
commit93230a64bc9369c726cc68d3f539b3bf66cff069 (patch)
tree0ad90cda9a0db39a058cbac8ceec67e6e7215354 /cmd-list.c
parent5f6a351df72f76f98ee1ed3494d025fe591fdb69 (diff)
Pass return code from _exec; allow command sequences to work from the command line.
Diffstat (limited to 'cmd-list.c')
-rw-r--r--cmd-list.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd-list.c b/cmd-list.c
index 8edaff56..870de3da 100644
--- a/cmd-list.c
+++ b/cmd-list.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-list.c,v 1.1 2009-01-18 14:40:48 nicm Exp $ */
+/* $Id: cmd-list.c,v 1.2 2009-01-19 18:23:40 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -60,13 +60,17 @@ bad:
return (NULL);
}
-void
+int
cmd_list_exec(struct cmd_list *cmdlist, struct cmd_ctx *ctx)
{
struct cmd *cmd;
+ int n;
- TAILQ_FOREACH(cmd, cmdlist, qentry)
- cmd_exec(cmd, ctx);
+ TAILQ_FOREACH(cmd, cmdlist, qentry) {
+ if ((n = cmd_exec(cmd, ctx)) != 0)
+ return (n);
+ }
+ return (0);
}
void