+\r
+/**\r
+ function to take a formatted argument and print it to a file.\r
+\r
+ @param[in] Handle the file handle for the file to write to\r
+ @param[in] Format the format argument (see printlib for format specifier)\r
+ @param[in] ... the variable arguments for the format\r
+\r
+ @retval EFI_SUCCESS the operation was sucessful\r
+ @return other a return value from FileHandleWriteLine\r
+\r
+ @sa FileHandleWriteLine\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FileHandlePrintLine(\r
+ IN EFI_FILE_HANDLE Handle,\r
+ IN CONST CHAR16 *Format,\r
+ ...\r
+ )\r
+{\r
+ VA_LIST Marker;\r
+ CHAR16 *Buffer;\r
+ EFI_STATUS Status;\r
+\r
+ VA_START (Marker, Format);\r
+\r
+ //\r
+ // Get a buffer to print into\r
+ //\r
+ Buffer = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));\r
+ ASSERT (Buffer != NULL);\r
+\r
+ //\r
+ // Print into our buffer\r
+ //\r
+ UnicodeVSPrint (Buffer, PcdGet16 (PcdShellPrintBufferSize), Format, Marker);\r
+\r
+ //\r
+ // Print buffer into file\r
+ //\r
+ Status = FileHandleWriteLine(Handle, Buffer);\r
+\r
+ //\r
+ // Cleanup and return \r
+ //\r
+ FreePool(Buffer);\r
+ return (Status);\r
+}\r
+\r
+/**\r
+ Function to determine if a FILE_HANDLE is at the end of the file.\r
+\r
+ This will NOT work on directories.\r
+\r
+ If Handle is NULL, then ASSERT.\r
+\r
+ @param[in] Handle the file handle\r
+\r
+ @retval TRUE the position is at the end of the file\r
+ @retval FALSE the position is not at the end of the file\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+FileHandleEof(\r
+ IN EFI_FILE_HANDLE Handle\r
+ )\r
+{\r
+ EFI_FILE_INFO *Info;\r
+ UINT64 Pos;\r
+ BOOLEAN RetVal;\r
+\r
+ //\r
+ // ASSERT if Handle is NULL\r
+ //\r
+ ASSERT(Handle != NULL);\r
+ \r
+ FileHandleGetPosition(Handle, &Pos);\r
+ Info = FileHandleGetInfo (Handle);\r
+ ASSERT(Info != NULL);\r
+ FileHandleSetPosition(Handle, Pos);\r
+ \r
+ if (Info == NULL) {\r
+ return (FALSE);\r
+ } \r
+\r
+ RetVal = (Pos == Info->FileSize)?TRUE:FALSE;\r
+\r
+ FreePool (Info);\r
+\r
+ return (RetVal);\r
+}
\ No newline at end of file