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.

Variables

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

Detailed Description

nslookup command

Definition in file nslookup_cmd.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER  )
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.

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

                                                   {
        struct nslookup_options opts;
        const char *name;
        const char *setting_name;
        int rc;

        /* Parse options */
        if ( ( rc = parse_options ( argc, argv, &nslookup_cmd, &opts ) ) != 0 )
                return rc;

        /* Parse setting name */
        setting_name = argv[optind];

        /* Parse name to be resolved */
        name = argv[ optind + 1 ];

        /* Look up name */
        if ( ( rc = nslookup ( name, setting_name ) ) != 0 )
                return rc;

        return 0;
}

Variable Documentation

struct option_descriptor nslookup_opts[] = {} [static]

"nslookup" option list

Definition at line 38 of file nslookup_cmd.c.

Initial value:
        COMMAND_DESC ( struct nslookup_options, nslookup_opts, 2, 2,
                       "<setting> <name>" )

"nslookup" command descriptor

Definition at line 41 of file nslookup_cmd.c.

struct command nslookup_command __command
Initial value:
 {
        .name = "nslookup",
        .exec = nslookup_exec,
}

The "nslookup" command.

Definition at line 76 of file nslookup_cmd.c.