TianoCore EDK2 master
Loading...
Searching...
No Matches
Cp.c File Reference

Go to the source code of this file.

Functions

SHELL_STATUS ValidateAndCopyFiles (IN CONST EFI_SHELL_FILE_INFO *FileList, IN CONST CHAR16 *DestDir, IN BOOLEAN SilentMode, IN BOOLEAN RecursiveMode, IN VOID **Resp)
 
SHELL_STATUS CopySingleFile (IN CONST CHAR16 *Source, IN CONST CHAR16 *Dest, OUT VOID **Resp, IN BOOLEAN SilentMode, IN CONST CHAR16 *CmdName)
 
SHELL_STATUS ProcessValidateAndCopyFiles (IN EFI_SHELL_FILE_INFO *FileList, IN CONST CHAR16 *DestDir, IN BOOLEAN SilentMode, IN BOOLEAN RecursiveMode)
 
SHELL_STATUS EFIAPI ShellCommandRunCp (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

STATIC CONST SHELL_PARAM_ITEM ParamList []
 

Detailed Description

Main file for cp shell level 2 function.

(C) Copyright 2015 Hewlett-Packard Development Company, L.P.
Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Cp.c.

Function Documentation

◆ CopySingleFile()

SHELL_STATUS CopySingleFile ( IN CONST CHAR16 *  Source,
IN CONST CHAR16 *  Dest,
OUT VOID **  Resp,
IN BOOLEAN  SilentMode,
IN CONST CHAR16 *  CmdName 
)

Function to Copy one file to another location

If the destination exists the user will be prompted and the result put into *resp

Parameters
[in]Sourcepointer to source file name
[in]Destpointer to destination file name
[out]Resppointer to response from question. Pass back on looped calling
[in]SilentModewhether to run in quiet mode or not
[in]CmdNameSource command name requesting single file copy
Return values
SHELL_SUCCESSThe source file was copied to the destination

Definition at line 54 of file Cp.c.

◆ ProcessValidateAndCopyFiles()

SHELL_STATUS ProcessValidateAndCopyFiles ( IN EFI_SHELL_FILE_INFO FileList,
IN CONST CHAR16 *  DestDir,
IN BOOLEAN  SilentMode,
IN BOOLEAN  RecursiveMode 
)

Validate and if successful copy all the files from the list into destination directory.

Parameters
[in]FileListThe list of files to copy.
[in]DestDirThe directory to copy files to.
[in]SilentModeTRUE to eliminate screen output.
[in]RecursiveModeTRUE to copy directories.
Return values
SHELL_INVALID_PARAMETERA parameter was invalid.
SHELL_SUCCESSThe operation was successful.

Definition at line 600 of file Cp.c.

◆ ShellCommandRunCp()

SHELL_STATUS EFIAPI ShellCommandRunCp ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'cp' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 658 of file Cp.c.

◆ ValidateAndCopyFiles()

SHELL_STATUS ValidateAndCopyFiles ( IN CONST EFI_SHELL_FILE_INFO FileList,
IN CONST CHAR16 *  DestDir,
IN BOOLEAN  SilentMode,
IN BOOLEAN  RecursiveMode,
IN VOID **  Resp 
)

Function to take a list of files to copy and a destination location and do the verification and copying of those files to that location. This function will report any errors to the user and halt.

Parameters
[in]FileListA LIST_ENTRY* based list of files to move.
[in]DestDirThe destination location.
[in]SilentModeTRUE to eliminate screen output.
[in]RecursiveModeTRUE to copy directories.
[in]RespThe response to the overwrite query (if always).
Return values
SHELL_SUCCESSthe files were all moved.
SHELL_INVALID_PARAMETERa parameter was invalid
SHELL_SECURITY_VIOLATIONa security violation ocurred
SHELL_WRITE_PROTECTEDthe destination was write protected
SHELL_OUT_OF_RESOURCESa memory allocation failed

function to take a list of files to copy and a destination location and do the verification and copying of those files to that location. This function will report any errors to the user and halt.

The key is to have this function called ONLY once. this allows for the parameter verification to happen correctly.

Parameters
[in]FileListA LIST_ENTRY* based list of files to move.
[in]DestDirThe destination location.
[in]SilentModeTRUE to eliminate screen output.
[in]RecursiveModeTRUE to copy directories.
[in]RespThe response to the overwrite query (if always).
Return values
SHELL_SUCCESSthe files were all moved.
SHELL_INVALID_PARAMETERa parameter was invalid
SHELL_SECURITY_VIOLATIONa security violation ocurred
SHELL_WRITE_PROTECTEDthe destination was write protected
SHELL_OUT_OF_RESOURCESa memory allocation failed

Definition at line 301 of file Cp.c.

Variable Documentation

◆ ParamList

Initial value:
= {
{ L"-r", TypeFlag },
{ L"-q", TypeFlag },
{ NULL, TypeMax }
}
#define NULL
Definition: Base.h:319
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699

Definition at line 644 of file Cp.c.