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