diff options
author | Greg Jednaszewski | 2011-04-08 20:33:51 +0200 |
---|---|---|
committer | Michael Brown | 2011-04-08 20:34:20 +0200 |
commit | 3726b3d94a630d8f3a1c1b983d2fd6e3274ed656 (patch) | |
tree | 4d54f504444604e0ac084cacea67c4eceb4ba4e7 /src/core/exec.c | |
parent | [cmdline] Simplify "isset" command (diff) | |
download | ipxe-3726b3d94a630d8f3a1c1b983d2fd6e3274ed656.tar.gz ipxe-3726b3d94a630d8f3a1c1b983d2fd6e3274ed656.tar.xz ipxe-3726b3d94a630d8f3a1c1b983d2fd6e3274ed656.zip |
[cmdline] Add "iseq" command
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/exec.c')
-rw-r--r-- | src/core/exec.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/core/exec.c b/src/core/exec.c index 18d3477e..bfc0c97f 100644 --- a/src/core/exec.c +++ b/src/core/exec.c @@ -490,3 +490,40 @@ struct command isset_command __command = { .name = "isset", .exec = isset_exec, }; + +/** "iseq" options */ +struct iseq_options {}; + +/** "iseq" option list */ +static struct option_descriptor iseq_opts[] = {}; + +/** "iseq" command descriptor */ +static struct command_descriptor iseq_cmd = + COMMAND_DESC ( struct iseq_options, iseq_opts, 2, 2, + "<value1> <value2>" ); + +/** + * "iseq" command + * + * @v argc Argument count + * @v argv Argument list + * @ret rc Return status code + */ +static int iseq_exec ( int argc, char **argv ) { + struct iseq_options opts; + int rc; + + /* Parse options */ + if ( ( rc = parse_options ( argc, argv, &iseq_cmd, &opts ) ) != 0 ) + return rc; + + /* Return success iff arguments are equal */ + return ( ( strcmp ( argv[optind], argv[ optind + 1 ] ) == 0 ) ? + 0 : -ERANGE ); +} + +/** "iseq" command */ +struct command iseq_command __command = { + .name = "iseq", + .exec = iseq_exec, +}; |