2 * Copyright (C) 2012 Patrick Plenefisch <phplenefisch@wpi.edu>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 FILE_LICENCE ( GPL2_OR_LATER
);
24 #include <ipxe/command.h>
25 #include <ipxe/parseopt.h>
26 #include <usr/nslookup.h>
34 /** "nslookup" options */
35 struct nslookup_options
{};
37 /** "nslookup" option list */
38 static struct option_descriptor nslookup_opts
[] = {};
40 /** "nslookup" command descriptor */
41 static struct command_descriptor nslookup_cmd
=
42 COMMAND_DESC ( struct nslookup_options
, nslookup_opts
, 2, 2,
46 * The "nslookup" command
48 * @v argc Argument count
49 * @v argv Argument list
50 * @ret rc Return status code
52 static int nslookup_exec ( int argc
, char **argv
) {
53 struct nslookup_options opts
;
55 const char *setting_name
;
59 if ( ( rc
= parse_options ( argc
, argv
, &nslookup_cmd
, &opts
) ) != 0 )
62 /* Parse setting name */
63 setting_name
= argv
[optind
];
65 /* Parse name to be resolved */
66 name
= argv
[ optind
+ 1 ];
69 if ( ( rc
= nslookup ( name
, setting_name
) ) != 0 )
75 /** The "nslookup" command */
76 struct command nslookup_command __command
= {
78 .exec
= nslookup_exec
,