/** @file
Establish the program environment and the "main" entry point.
All of the global data in the gMD structure is initialized to 0, NULL, or
SIG_DFL; as appropriate.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Uefi.h>
#include <Library/DebugLib.h>
#include <Library/ShellCEntryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/TimerLib.h>
#include <LibConfig.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <MainData.h>
#include <unistd.h>
extern int main( int, char**);
extern int __sse2_available;
/* Worker function to keep GCC happy. */
void __main()
{
;
}
/** Clean up data as required by the exit() function.
**/
void
{
void (*CleanUp)(void); // Pointer to Cleanup Function
int i;
// Call all registered atexit functions in reverse order
i = gMD->num_atexit;
if( i > 0) {
do {
(gMD->atexit_handler[--i])();
} while( i > 0);
}
CleanUp();
}
}
}
/* Create mbcs versions of the Argv strings. */
static
char **
{
char **nArgv;
char *string;
}
/* Determine space needed for narrow Argv strings. */
if(AVsz < 0) {
/* Not Reached */
}
}
/* Reserve space for the converted strings. */
Print(L"ABORTING: Insufficient memory.\n");
/* Not Reached */
}
/* Convert Argument Strings. */
DEBUG((DEBUG_INFO, "Cvt[%d] %d \"%s\" --> \"%a\"\n", (INT32)count, (INT32)AVsz, Argv[count], nArgv[count]));
if(nArgvSize < 0) {
/* Not Reached */
}
}
}
)
{
char **nArgv;
int i;
}
else {
/* Initialize data */
__sse2_available = 0;
_fltused = 1;
errno = 0;
EFIerrno = 0;
// Initialize file descriptors
for(i = 0; i < (FOPEN_MAX); ++i) {
}
if(i == 0) {
if(i == 1) {
}
}
if(i != 2) {
Print(L"ERROR Initializing Standard IO: %a.\n %r\n",
}
/* Create mbcs versions of the Argv strings. */
}
else {
}
/* You reach here if:
* normal return from main()
* call to _Exit(), either directly or through exit().
*/
}
if( ExitVal == EXIT_FAILURE) {
}
/* Close any open files */
for(i = OPEN_MAX - 1; i >= 0; --i) {
(void)close(i); // Close properly handles closing a closed file.
}
/* Free the global MainData structure */
}
}
}
return ExitVal;
}