4 Copyright (c) 2011-2012, 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.
20 #include <Library/DebugLib.h>
21 #include <Library/UefiLib.h>
23 #include <sys/socket.h>
31 @param [in] Argc The number of arguments
32 @param [in] Argv The argument value array
34 @retval 0 The application exited normally.
35 @retval Other An error occurred.
50 // Determine if the host name is specified
57 AppStatus
= sethostname ( Argv
[1], strlen ( Argv
[1]));
58 if ( -1 == AppStatus
) {
61 Print ( L
"ERROR - errno: %d\r\n", errno
);
65 Print ( L
"WARNING - Plarform does not support permanent storage!\r\n" );
69 Print ( L
"ERROR - Insufficient storage to save host name!\r\n" );
73 Print ( L
"ERROR - Platform does not support environment variable storage!\r\n" );
80 // Display the current host name
82 AppStatus
= gethostname ( &mBuffer
[0], sizeof ( mBuffer
));
83 if ( -1 == AppStatus
) {
84 Print ( L
"ERROR - Unable to get host name, errno: %d\r\n", errno
);
87 if ( 0 == mBuffer
[0]) {
88 Print ( L
"Host name is not set!\r\n" );
91 Print ( L
"Host name: %a", &mBuffer
[0]);