iPXE
Data Structures | Functions | Variables
nslookup_cmd.c File Reference

nslookup command More...

#include <stdio.h>
#include <getopt.h>
#include <ipxe/command.h>
#include <ipxe/parseopt.h>
#include <usr/nslookup.h>

Go to the source code of this file.

Data Structures

struct  nslookup_options
 "nslookup" options More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
static int nslookup_exec (int argc, char **argv)
 The "nslookup" command. More...
 

Variables

static struct option_descriptor nslookup_opts [] = {}
 "nslookup" option list More...
 
static struct command_descriptor nslookup_cmd
 "nslookup" command descriptor More...
 
struct command nslookup_command __command
 The "nslookup" command. More...
 

Detailed Description

nslookup command

Definition in file nslookup_cmd.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ nslookup_exec()

static int nslookup_exec ( int  argc,
char **  argv 
)
static

The "nslookup" command.

Parameters
argcArgument count
argvArgument list
Return values
rcReturn status code

Definition at line 52 of file nslookup_cmd.c.

52  {
53  struct nslookup_options opts;
54  const char *name;
55  const char *setting_name;
56  int rc;
57 
58  /* Parse options */
59  if ( ( rc = parse_options ( argc, argv, &nslookup_cmd, &opts ) ) != 0 )
60  return rc;
61 
62  /* Parse setting name */
63  setting_name = argv[optind];
64 
65  /* Parse name to be resolved */
66  name = argv[ optind + 1 ];
67 
68  /* Look up name */
69  if ( ( rc = nslookup ( name, setting_name ) ) != 0 )
70  return rc;
71 
72  return 0;
73 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
int optind
Current option index.
Definition: getopt.c:51
int parse_options(int argc, char **argv, struct command_descriptor *cmd, void *opts)
Parse command-line options.
Definition: parseopt.c:484
"nslookup" options
Definition: nslookup_cmd.c:35
static union @437 opts
"cert<xxx>" option list
int setting_name(struct settings *settings, const struct setting *setting, char *buf, size_t len)
Return full setting name.
Definition: settings.c:1606
static struct command_descriptor nslookup_cmd
"nslookup" command descriptor
Definition: nslookup_cmd.c:41
A name resolution request.
Definition: nslookup.c:39

References name, nslookup_cmd, optind, opts, parse_options(), rc, and setting_name().

Variable Documentation

◆ nslookup_opts

struct option_descriptor nslookup_opts[] = {}
static

"nslookup" option list

Definition at line 38 of file nslookup_cmd.c.

◆ nslookup_cmd

struct command_descriptor nslookup_cmd
static
Initial value:
=
"<setting> <name>" )
static struct option_descriptor nslookup_opts[]
"nslookup" option list
Definition: nslookup_cmd.c:38
"nslookup" options
Definition: nslookup_cmd.c:35
#define COMMAND_DESC(_struct, _options, _min_args, _max_args, _usage)
Construct command descriptor.
Definition: parseopt.h:108

"nslookup" command descriptor

Definition at line 41 of file nslookup_cmd.c.

Referenced by nslookup_exec().

◆ __command

struct command nslookup_command __command
Initial value:
= {
.name = "nslookup",
.exec = nslookup_exec,
}
static int nslookup_exec(int argc, char **argv)
The "nslookup" command.
Definition: nslookup_cmd.c:52

The "nslookup" command.

Definition at line 76 of file nslookup_cmd.c.