wok annotate ipxe/stuff/cmd_isgt.u @ rev 24669
updated inxi (3.0.37 -> 3.3.13)
author | Hans-G?nter Theisgen |
---|---|
date | Fri Mar 11 16:49:52 2022 +0100 (2022-03-11) |
parents | |
children |
rev | line source |
---|---|
pascal@23972 | 1 --- src/core/exec.c |
pascal@23972 | 2 +++ src/core/exec.c |
pascal@23972 | 3 @@ -549,6 +549,49 @@ |
pascal@23972 | 4 .exec = iseq_exec, |
pascal@23972 | 5 }; |
pascal@23972 | 6 |
pascal@23972 | 7 +/** "isgt" options */ |
pascal@23972 | 8 +struct isgt_options {}; |
pascal@23972 | 9 + |
pascal@23972 | 10 +/** "isgt" option list */ |
pascal@23972 | 11 +static struct option_descriptor isgt_opts[] = {}; |
pascal@23972 | 12 + |
pascal@23972 | 13 +/** "isgt" command descriptor */ |
pascal@23972 | 14 +static struct command_descriptor isgt_cmd = |
pascal@23972 | 15 + COMMAND_DESC ( struct isgt_options, isgt_opts, 2, 2, |
pascal@23972 | 16 + "<value1> <value2>" ); |
pascal@23972 | 17 + |
pascal@23972 | 18 +/** |
pascal@23972 | 19 + * "isgt" command |
pascal@23972 | 20 + * |
pascal@23972 | 21 + * @v argc Argument count |
pascal@23972 | 22 + * @v argv Argument list |
pascal@23972 | 23 + * @ret rc Return status code |
pascal@23972 | 24 + */ |
pascal@23972 | 25 +static int isgt_exec ( int argc, char **argv ) { |
pascal@23972 | 26 + struct isgt_options opts; |
pascal@23972 | 27 + unsigned int a, b; |
pascal@23972 | 28 + int rc; |
pascal@23972 | 29 + |
pascal@23972 | 30 + /* Parse options */ |
pascal@23972 | 31 + if ( ( rc = parse_options ( argc, argv, &isgt_cmd, &opts ) ) != 0 ) |
pascal@23972 | 32 + return rc; |
pascal@23972 | 33 + |
pascal@23972 | 34 + /* Parse numbers */ |
pascal@23972 | 35 + if ( ( rc = parse_integer ( argv[optind], &a ) ) != 0 ) |
pascal@23972 | 36 + return rc; |
pascal@23972 | 37 + if ( ( rc = parse_integer ( argv[optind + 1], &b ) ) != 0 ) |
pascal@23972 | 38 + return rc; |
pascal@23972 | 39 + |
pascal@23972 | 40 + /* Return success if a is greater than b */ |
pascal@23972 | 41 + return ( ( a > b ) ? 0 : -ERANGE ); |
pascal@23972 | 42 +} |
pascal@23972 | 43 + |
pascal@23972 | 44 +/** "isgt" command */ |
pascal@23972 | 45 +struct command isgt_command __command = { |
pascal@23972 | 46 + .name = "isgt", |
pascal@23972 | 47 + .exec = isgt_exec, |
pascal@23972 | 48 +}; |
pascal@23972 | 49 + |
pascal@23972 | 50 /** "sleep" options */ |
pascal@23972 | 51 struct sleep_options {}; |
pascal@23972 | 52 |