/** Function for 'timezone' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). **/ SHELL_STATUS EFIAPI ShellCommandRunTimeZone ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { // // non interactive // EFI_STATUS Status; LIST_ENTRY *Package; CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; UINT8 LoopVar; EFI_TIME TheTime; BOOLEAN Found; UINTN TzMinutes; ShellStatus = SHELL_SUCCESS; ProblemParam = NULL; // // initialize the shell lib (we must be in non-auto-init...) // Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); // // parse the command line // if (PcdGet8(PcdShellSupportLevel) == 2) { Status = ShellCommandLineParse (TimeZoneParamList2, &Package, &ProblemParam, TRUE); } else { ASSERT(PcdGet8(PcdShellSupportLevel) == 3); Status = ShellCommandLineParseEx (TimeZoneParamList3, &Package, &ProblemParam, TRUE, TRUE); } if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(FALSE); } } else { // // check for "-?" // if (ShellCommandLineGetCount(Package) > 1) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle); ShellStatus = SHELL_INVALID_PARAMETER; } else if (ShellCommandLineGetFlag(Package, L"-?")) { ASSERT(FALSE); } else if (ShellCommandLineGetFlag(Package, L"-s")) { if ((ShellCommandLineGetFlag(Package, L"-l")) || (ShellCommandLineGetFlag(Package, L"-f"))) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"-l or -f"); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(PcdGet8(PcdShellSupportLevel) == 3); if (ShellCommandLineGetValue(Package, L"-s") == NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellLevel2HiiHandle, L"-s"); ShellStatus = SHELL_INVALID_PARAMETER; } else { // // Set the time zone // ShellStatus = CheckAndSetTimeZone(ShellCommandLineGetValue(Package, L"-s")); if (ShellStatus != SHELL_SUCCESS) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ShellCommandLineGetValue(Package, L"-s")); ShellStatus = SHELL_INVALID_PARAMETER; } } } } else if (ShellCommandLineGetFlag(Package, L"-l")) { // // Print a list of all time zones // for ( LoopVar = 0 ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0]) ; LoopVar++ ){ ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle); } } else { // // Get Current Time Zone Info // Status = gRT->GetTime(&TheTime, NULL); ASSERT_EFI_ERROR(Status); if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { Found = FALSE; for ( LoopVar = 0 ; LoopVar < sizeof(TimeZoneList) / sizeof(TimeZoneList[0]) ; LoopVar++ ){ if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) { if (ShellCommandLineGetFlag(Package, L"-f")) { // // Print all info about current time zone // ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle); } else { // // Print basic info only // if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; } ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_SIMPLE), gShellLevel2HiiHandle, TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"), TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes); } Found = TRUE; break; } } if (!Found) { // // Print basic info only // if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; } ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_SIMPLE), gShellLevel2HiiHandle, TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"), TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes); if (ShellCommandLineGetFlag(Package, L"-f")) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_NI), gShellLevel2HiiHandle); } } } else { // // TimeZone was EFI_UNSPECIFIED_TIMEZONE (unknown) from GetTime() // } } } // // free the command line package // ShellCommandLineFreeVarList (Package); return (ShellStatus); }
/** Function for 'time' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). **/ SHELL_STATUS EFIAPI ShellCommandRunTime ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; LIST_ENTRY *Package; EFI_TIME TheTime; CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; INT16 Tz; UINT8 Daylight; CONST CHAR16 *TempLocation; UINTN TzMinutes; // // Initialize variables // ShellStatus = SHELL_SUCCESS; ProblemParam = NULL; // // initialize the shell lib (we must be in non-auto-init...) // Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); // // parse the command line // if (PcdGet8(PcdShellSupportLevel) == 2) { Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE); } else { ASSERT(PcdGet8(PcdShellSupportLevel) == 3); Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE); } if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, L"time", ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(FALSE); } } else { // // check for "-?" // Status = gRT->GetTime(&TheTime, NULL); if (EFI_ERROR(Status)) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", Status); return (SHELL_DEVICE_ERROR); } if (ShellCommandLineGetFlag(Package, L"-?")) { ASSERT(FALSE); } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time"); ShellStatus = SHELL_INVALID_PARAMETER; } else { // // If there are no parameters, then print the current time // if (ShellCommandLineGetRawValue(Package, 1) == NULL && !ShellCommandLineGetFlag(Package, L"-d") && !ShellCommandLineGetFlag(Package, L"-tz")) { // // ShellPrintEx the current time // if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; } if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TIME_FORMAT), gShellLevel2HiiHandle, TheTime.Hour, TheTime.Minute, TheTime.Second, (TheTime.TimeZone > 0?L"-":L"+"), ((ABS(TheTime.TimeZone)) / 60), TzMinutes ); } else { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TIME_FORMAT_LOCAL), gShellLevel2HiiHandle, TheTime.Hour, TheTime.Minute, TheTime.Second ); } ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle); } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) { if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TIME_FORMAT_LOCAL), gShellLevel2HiiHandle, TheTime.Hour, TheTime.Minute, TheTime.Second ); } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TIME_FORMAT), gShellLevel2HiiHandle, TheTime.Hour, TheTime.Minute, TheTime.Second, (TheTime.TimeZone > 0?L"-":L"+"), ((ABS(TheTime.TimeZone)) / 60), TzMinutes ); } switch (TheTime.Daylight) { case 0: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST0), gShellLevel2HiiHandle); break; case EFI_TIME_ADJUST_DAYLIGHT: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST1), gShellLevel2HiiHandle); break; case EFI_TIME_IN_DAYLIGHT: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST2), gShellLevel2HiiHandle); break; case EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST3), gShellLevel2HiiHandle); break; default: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_ERROR), gShellLevel2HiiHandle, L"time", L"gRT->GetTime", L"TheTime.Daylight", TheTime.Daylight); } } else { if (PcdGet8(PcdShellSupportLevel) == 2) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle, L"time"); ShellStatus = SHELL_INVALID_PARAMETER; } else { // // perform level 3 operation here. // if ((TempLocation = ShellCommandLineGetValue(Package, L"-tz")) != NULL) { if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16 *)TempLocation, L"_local") == 0) { Tz = EFI_UNSPECIFIED_TIMEZONE; } else if (TempLocation[0] == L'-') { Tz = (INT16) ShellStrToUintn (++TempLocation); // // When the argument of "time [-tz tz]" is not numeric, ShellStrToUintn() returns "-1". // Here we can detect the argument error by checking the return of ShellStrToUintn(). // if (Tz == -1) { Tz = 1441; //make it to be out of bounds value } else { Tz *= (-1); //sign convert } } else { if (TempLocation[0] == L'+') { Tz = (INT16)ShellStrToUintn (++TempLocation); } else { Tz = (INT16)ShellStrToUintn (TempLocation); } // // Detect the return of ShellStrToUintn() to make sure the argument is valid. // if (Tz == -1) { Tz = 1441; //make it to be out of bounds value } } if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-tz"); ShellStatus = SHELL_INVALID_PARAMETER; } } else { // // intentionally out of bounds value will prevent changing it... // Tz = 1441; } TempLocation = ShellCommandLineGetValue(Package, L"-d"); if (TempLocation != NULL) { Daylight = (UINT8)ShellStrToUintn(TempLocation); // // The argument of "time [-d dl]" is unsigned, if the first character is '-', // the argument is incorrect. That's because ShellStrToUintn() will skip past // any '-' sign and convert what's next, forgetting the sign is here. // if (TempLocation[0] == '-') { Daylight = 0xff; //make it invalid = will not use } if (Daylight != 0 && Daylight != 1 && Daylight != 3) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"time", TempLocation, L"-d"); ShellStatus = SHELL_INVALID_PARAMETER; } } else { // // invalid = will not use // Daylight = 0xFF; } if (ShellStatus == SHELL_SUCCESS) { ShellStatus = CheckAndSetTime(ShellCommandLineGetRawValue(Package, 1), Tz, Daylight); if (ShellStatus != SHELL_SUCCESS) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle, L"time", ShellCommandLineGetRawValue(Package, 1)); ShellStatus = SHELL_INVALID_PARAMETER; } } } } } } // // free the command line package // ShellCommandLineFreeVarList (Package); // // return the status // return (ShellStatus); }
/** Function for 'time' command. @param[in] ImageHandle Handle to the Image (NULL if Internal). @param[in] SystemTable Pointer to the System Table (NULL if Internal). **/ SHELL_STATUS EFIAPI ShellCommandRunTime ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; LIST_ENTRY *Package; CHAR16 *Message; EFI_TIME TheTime; CHAR16 *ProblemParam; SHELL_STATUS ShellStatus; INT16 Tz; UINT8 Daylight; CONST CHAR16 *TempLocation; UINTN TzMinutes; ShellStatus = SHELL_SUCCESS; ProblemParam = NULL; // // Initialize variables // Message = NULL; // // initialize the shell lib (we must be in non-auto-init...) // Status = ShellInitialize(); ASSERT_EFI_ERROR(Status); // // parse the command line // if (PcdGet8(PcdShellSupportLevel) == 2) { Status = ShellCommandLineParseEx (TimeParamList2, &Package, &ProblemParam, TRUE, TRUE); } else { ASSERT(PcdGet8(PcdShellSupportLevel) == 3); Status = ShellCommandLineParseEx (TimeParamList3, &Package, &ProblemParam, TRUE, TRUE); } if (EFI_ERROR(Status)) { if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ProblemParam); FreePool(ProblemParam); ShellStatus = SHELL_INVALID_PARAMETER; } else { ASSERT(FALSE); } } else { // // check for "-?" // Status = gRT->GetTime(&TheTime, NULL); ASSERT_EFI_ERROR(Status); if (ShellCommandLineGetFlag(Package, L"-?")) { ASSERT(FALSE); } else if (ShellCommandLineGetRawValue(Package, 2) != NULL) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle); ShellStatus = SHELL_INVALID_PARAMETER; } else { // // If there are no parameters, then print the current time // if (ShellCommandLineGetRawValue(Package, 1) == NULL && !ShellCommandLineGetFlag(Package, L"-d") && !ShellCommandLineGetFlag(Package, L"-tz")) { // // ShellPrintEx the current time // if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; } ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TIME_FORMAT), gShellLevel2HiiHandle, TheTime.Hour, TheTime.Minute, TheTime.Second, TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"), TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes ); ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle); } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) { if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { TzMinutes = 0; } else { TzMinutes = (ABS(TheTime.TimeZone)) % 60; } ShellPrintHiiEx ( -1, -1, NULL, STRING_TOKEN (STR_TIME_FORMAT), gShellLevel2HiiHandle, TheTime.Hour, TheTime.Minute, TheTime.Second, TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"), TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, TzMinutes ); switch (TheTime.Daylight) { case 0: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST0), gShellLevel2HiiHandle); break; case EFI_TIME_ADJUST_DAYLIGHT: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST1), gShellLevel2HiiHandle); break; case EFI_TIME_IN_DAYLIGHT: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST2), gShellLevel2HiiHandle); break; case EFI_TIME_IN_DAYLIGHT|EFI_TIME_ADJUST_DAYLIGHT: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TIME_DST3), gShellLevel2HiiHandle); break; default: ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_ERROR), gShellLevel2HiiHandle, L"gRT->GetTime", L"TheTime.Daylight", TheTime.Daylight); } } else { if (PcdGet8(PcdShellSupportLevel) == 2) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellLevel2HiiHandle); ShellStatus = SHELL_INVALID_PARAMETER; } else { // // perform level 3 operation here. // if ((TempLocation = ShellCommandLineGetValue(Package, L"-tz")) != NULL) { if (TempLocation[0] == L'-') { Tz = (INT16)(0 - ShellStrToUintn(++TempLocation)); } else { Tz = (INT16)ShellStrToUintn(TempLocation); } if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-tz"); ShellStatus = SHELL_INVALID_PARAMETER; } } else { // // intentionally out of bounds value will prevent changing it... // Tz = 1441; } TempLocation = ShellCommandLineGetValue(Package, L"-d"); if (TempLocation != NULL) { Daylight = (UINT8)ShellStrToUintn(TempLocation); if (Daylight != 0 && Daylight != 1 && Daylight != 3) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-d"); ShellStatus = SHELL_INVALID_PARAMETER; } } else { // // invalid = will not use // Daylight = 0xFF; } if (ShellStatus == SHELL_SUCCESS) { ShellStatus = CheckAndSetTime(ShellCommandLineGetRawValue(Package, 1), Tz, Daylight); if (ShellStatus != SHELL_SUCCESS) { ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel2HiiHandle, ShellCommandLineGetRawValue(Package, 1)); ShellStatus = SHELL_INVALID_PARAMETER; } } } } } } // // free the command line package // ShellCommandLineFreeVarList (Package); // // return the status // return (ShellStatus); }
/** This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers, including both device drivers and bus drivers. The entry point for the IfConfig6 application which parses the command line input and calls the IfConfig6 process. @param[in] ImageHandle The image handle of this application. @param[in] SystemTable The pointer to the EFI System Table. @retval EFI_SUCCESS The operation completed successfully. @retval Others Some errors occur. **/ EFI_STATUS EFIAPI IfConfig6Initialize ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; IFCONFIG6_PRIVATE_DATA *Private; LIST_ENTRY *ParamPackage; CONST CHAR16 *ValueStr; ARG_LIST *ArgList; CHAR16 *ProblemParam; CHAR16 *Str; Private = NULL; // // Register our string package with HII and return the handle to it. // mHiiHandle = HiiAddPackages (&gEfiCallerIdGuid, ImageHandle, IfConfig6Strings, NULL); ASSERT (mHiiHandle != NULL); Status = ShellCommandLineParseEx (mIfConfig6CheckList, &ParamPackage, &ProblemParam, TRUE, FALSE); if (EFI_ERROR (Status)) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_INVALID_COMMAND), mHiiHandle, ProblemParam); goto ON_EXIT; } // // To handle no option. // if (!ShellCommandLineGetFlag (ParamPackage, L"-r") && !ShellCommandLineGetFlag (ParamPackage, L"-s") && !ShellCommandLineGetFlag (ParamPackage, L"-?") && !ShellCommandLineGetFlag (ParamPackage, L"-l")) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_LACK_OPTION), mHiiHandle); goto ON_EXIT; } // // To handle conflict options. // if (((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-s"))) || ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || ((ShellCommandLineGetFlag (ParamPackage, L"-r")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) || ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-l"))) || ((ShellCommandLineGetFlag (ParamPackage, L"-s")) && (ShellCommandLineGetFlag (ParamPackage, L"-?"))) || ((ShellCommandLineGetFlag (ParamPackage, L"-l")) && (ShellCommandLineGetFlag (ParamPackage, L"-?")))) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_CONFLICT_OPTIONS), mHiiHandle); goto ON_EXIT; } // // To show the help information of ifconfig6 command. // if (ShellCommandLineGetFlag (ParamPackage, L"-?")) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_HELP), mHiiHandle); goto ON_EXIT; } Status = EFI_INVALID_PARAMETER; Private = AllocateZeroPool (sizeof (IFCONFIG6_PRIVATE_DATA)); if (Private == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; } InitializeListHead (&Private->IfList); // // To get interface name for the list option. // if (ShellCommandLineGetFlag (ParamPackage, L"-l")) { Private->OpCode = IfConfig6OpList; ValueStr = ShellCommandLineGetValue (ParamPackage, L"-l"); if (ValueStr != NULL) { Str = AllocateCopyPool (StrSize (ValueStr), ValueStr); ASSERT (Str != NULL); Private->IfName = Str; } } // // To get interface name for the clear option. // if (ShellCommandLineGetFlag (ParamPackage, L"-r")) { Private->OpCode = IfConfig6OpClear; ValueStr = ShellCommandLineGetValue (ParamPackage, L"-r"); if (ValueStr != NULL) { Str = AllocateCopyPool (StrSize (ValueStr), ValueStr); ASSERT (Str != NULL); Private->IfName = Str; } } // // To get interface name and corresponding Args for the set option. // if (ShellCommandLineGetFlag (ParamPackage, L"-s")) { ValueStr = ShellCommandLineGetValue (ParamPackage, L"-s"); if (ValueStr == NULL) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_INTERFACE), mHiiHandle); goto ON_EXIT; } // // To split the configuration into multi-section. // ArgList = SplitStrToList (ValueStr, L' '); ASSERT (ArgList != NULL); Private->OpCode = IfConfig6OpSet; Private->IfName = ArgList->Arg; Private->VarArg = ArgList->Next; if (Private->IfName == NULL || Private->VarArg == NULL) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_IFCONFIG6_ERR_LACK_COMMAND), mHiiHandle); goto ON_EXIT; } } // // Main process of ifconfig6. // Status = IfConfig6 (Private); ON_EXIT: ShellCommandLineFreeVarList (ParamPackage); HiiRemovePackages (mHiiHandle); if (Private != NULL) IfConfig6Cleanup (Private); return Status; }