/** @file
Main file for Touch shell level 3 function.
Copyright (c) 2009 - 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
which 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 "UefiShellLevel3CommandsLib.h"
#include <Library/ShellLib.h>
/**
Do the touch operation on a single handle.
@retval EFI_ACCESS_DENIED The file referenced by Handle is read only.
@retval EFI_SUCCESS The operation was successful.
**/
)
{
return (EFI_ACCESS_DENIED);
}
return (Status);
}
/**
Touch a given file and potantially recurse down if it was a directory.
@param[in] Name The name of this file.
@param[in] FS The name of the file system this file is on.
@param[in] Handle The handle of this file already opened.
@param[in] Rec TRUE to recurse if possible.
@retval EFI_INVALID_PARAMETER A parameter was invalid.
@retval EFI_SUCCESS The operation was successful.
**/
)
{
}
}
}
return (EFI_INVALID_PARAMETER);
}
//
// do it
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NO_OPEN), gShellLevel3HiiHandle, Name, Status);
return (Status);
}
//
// if it's a directory recurse...
//
//
// get each file under this directory
//
}
//
// recurse on each
//
){
){
//
// Open the file since we need that handle.
//
Status = gEfiShellProtocol->OpenFileByName (Walker->FullName, &Walker->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NO_OPEN), gShellLevel3HiiHandle, Walker->FullName, Status);
} else {
}
}
}
//
// free stuff
//
}
}
return (Status);
}
{L"-r", TypeFlag},
};
/**
Function for 'touch' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
)
{
ProblemParam = NULL;
ParamCount = 0;
//
// initialize the shell lib (we must be in non-auto-init...)
//
Status = ShellInitialize();
Status = CommandInit();
//
// parse the command line
//
} else {
}
} else {
//
// check for "-?"
//
}
//
// we insufficient parameters
//
} else {
//
// get a list with each file specified by parameters
// if parameter is a directory then add all the files below it to the list
//
){
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, (CHAR16*)Param);
break;
}
//
// make sure we completed the param parsing sucessfully...
// Also make sure that any previous action was sucessful
//
if (ShellStatus == SHELL_SUCCESS) {
//
// check that we have at least 1 file
//
continue;
} else {
//
// loop through the list and make sure we are not aborting...
//
){
//
// make sure the file opened ok
//
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NO_OPEN), gShellLevel3HiiHandle, Node->FileName, Node->Status);
continue;
}
Status = DoTouchByHandle(Node->FullName, NULL, Node->Handle, ShellCommandLineGetFlag(Package, L"-r"));
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_NO_OPEN), gShellLevel3HiiHandle, Node->FileName, Status);
}
}
}
}
//
// Free the fileList
//
}
}
}
//
// free the command line package
//
}
if (ShellGetExecutionBreakFlag()) {
return (SHELL_ABORTED);
}
return (ShellStatus);
}