2 Translate the host name into an IP address
4 Copyright (c) 2011, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #include <Library/DebugLib.h>
22 #include <Library/UefiLib.h>
24 #include <sys/socket.h>
26 struct hostent
* _gethostbydnsname (const char *, int);
32 Translate the host name into an IP address
34 @param [in] Argc The number of arguments
35 @param [in] Argv The argument value array
37 @retval 0 The application exited normally.
38 @retval Other An error occurred.
48 struct hostent
* pHost
;
55 // Determine if the host name is specified
59 Print ( L
"%a <host name>\r\n", Argv
[0]);
63 // Translate the host name
65 pHost
= _gethostbydnsname ( Argv
[1], AF_INET
);
66 if ( NULL
== pHost
) {
67 Print ( L
"ERROR - host not found, h_errno: %d\r\n", h_errno
);
70 pIpAddress
= (UINT8
*)pHost
->h_addr
;
71 Print ( L
"%a: Type %d, %d.%d.%d.%d\r\n",