]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Network/PxeBc/Dxe/Print.c
Perfected MSA files.
[mirror_edk2.git] / EdkModulePkg / Universal / Network / PxeBc / Dxe / Print.c
1 /*++
2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
7
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 Module Name:
12 Print.c
13
14 Abstract:
15
16 --*/
17
18
19 #include <Bc.h>
20
21 UINTN
22 EFIAPI
23 AsciiPrint (
24 IN CONST CHAR8 *Format,
25 ...
26 )
27 /*++
28
29 Routine Description:
30
31 Print function for a maximum of PXE_MAX_PRINT_BUFFER ascii
32 characters.
33
34 Arguments:
35
36 Format - Ascii format string see file header for more details.
37
38 ... - Vararg list consumed by processing Format.
39
40 Returns:
41
42 Number of characters printed.
43
44 --*/
45 {
46 UINTN Return;
47 VA_LIST Marker;
48 UINTN Index;
49 UINTN MaxIndex;
50 CHAR16 Buffer[PXE_MAX_PRINT_BUFFER];
51 CHAR16 UnicodeFormat[PXE_MAX_PRINT_BUFFER];
52
53 MaxIndex = AsciiStrLen ((CHAR8 *) Format);
54 if (MaxIndex > PXE_MAX_PRINT_BUFFER) {
55 //
56 // Format string was too long for use to process.
57 //
58 return 0;
59 }
60
61 for (Index = 0; Index < PXE_MAX_PRINT_BUFFER; Index++) {
62 UnicodeFormat[Index] = (CHAR16) Format[Index];
63 }
64
65 VA_START (Marker, Format);
66 Return = UnicodeVSPrint (Buffer, sizeof (Buffer), UnicodeFormat, Marker);
67 VA_END (Marker);
68
69 //
70 // Need to convert to Unicode to do an OutputString
71 //
72
73 if (gST->ConOut != NULL) {
74 //
75 // To be extra safe make sure ConOut has been initialized
76 //
77 gST->ConOut->OutputString (gST->ConOut, Buffer);
78 }
79
80 return Return;
81 }