Commit 174dabb5 authored by Niels Möller's avatar Niels Möller
Browse files

* src/command.c, src/command.h (command_die_on_null): New command.

Don't know how useful it is.

Rev: src/command.c:1.15
Rev: src/command.h:1.18
parent 52169605
......@@ -93,6 +93,24 @@ do_command_simple_unimplemented(struct command_simple *s UNUSED,
struct command_simple command_unimplemented =
{ { STATIC_HEADER, do_command_unimplemented}, do_command_simple_unimplemented};
/* Fail if NULL. This commands returns its argument unchanged. Unless
* it is NULL, in which case it doesn't return at all, but instead
* returns an LSH_FAIL status to the mainloop. */
static int
do_command_die_on_null(struct command *s,
struct lsh_object *x,
struct command_continuation *c)
return x ? COMMAND_RETURN(c, x) : LSH_FAIL | LSH_DIE;
struct command command_die_on_null =
{ STATIC_HEADER, do_command_die_on_null};
/* Collecting arguments */
struct lsh_object *
do_collect_1(struct command_simple *s, struct lsh_object *a)
......@@ -166,6 +166,8 @@ make_collect_state_3(struct collect_info_3 *info,
extern struct command_simple command_unimplemented;
#define COMMAND_UNIMPLEMENTED (&command_unimplemented.super.super)
struct command command_die_on_null;
/* The GABA_* macros are used by automatically generated evaluation code */
struct command_continuation *
Supports Markdown
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