diff options
Diffstat (limited to 'source/components/utilities/utprint.c')
| -rw-r--r-- | source/components/utilities/utprint.c | 121 |
1 files changed, 107 insertions, 14 deletions
diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index e01f1734a94f..7d4c48939aeb 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -416,7 +416,7 @@ AcpiUtFormatNumber ( /******************************************************************************* * - * FUNCTION: AcpiUtVsnprintf + * FUNCTION: vsnprintf * * PARAMETERS: String - String with boundary * Size - Boundary of the string @@ -430,7 +430,7 @@ AcpiUtFormatNumber ( ******************************************************************************/ int -AcpiUtVsnprintf ( +vsnprintf ( char *String, ACPI_SIZE Size, const char *Format, @@ -713,7 +713,7 @@ AcpiUtVsnprintf ( /******************************************************************************* * - * FUNCTION: AcpiUtSnprintf + * FUNCTION: snprintf * * PARAMETERS: String - String with boundary * Size - Boundary of the string @@ -726,7 +726,7 @@ AcpiUtVsnprintf ( ******************************************************************************/ int -AcpiUtSnprintf ( +snprintf ( char *String, ACPI_SIZE Size, const char *Format, @@ -737,7 +737,38 @@ AcpiUtSnprintf ( va_start (Args, Format); - Length = AcpiUtVsnprintf (String, Size, Format, Args); + Length = vsnprintf (String, Size, Format, Args); + va_end (Args); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: sprintf + * + * PARAMETERS: String - String with boundary + * Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to a string. + * + ******************************************************************************/ + +int +sprintf ( + char *String, + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = vsnprintf (String, ACPI_UINT32_MAX, Format, Args); va_end (Args); return (Length); @@ -747,7 +778,69 @@ AcpiUtSnprintf ( #ifdef ACPI_APPLICATION /******************************************************************************* * - * FUNCTION: AcpiUtFileVprintf + * FUNCTION: vprintf + * + * PARAMETERS: Format - Standard printf format + * Args - Argument list + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to stdout using argument list pointer. + * + ******************************************************************************/ + +int +vprintf ( + const char *Format, + va_list Args) +{ + ACPI_CPU_FLAGS Flags; + int Length; + + + Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); + Length = vsnprintf (AcpiGbl_PrintBuffer, + sizeof (AcpiGbl_PrintBuffer), Format, Args); + + (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, ACPI_FILE_OUT); + AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: printf + * + * PARAMETERS: Format, ... - Standard printf format + * + * RETURN: Number of bytes actually written. + * + * DESCRIPTION: Formatted output to stdout. + * + ******************************************************************************/ + +int +printf ( + const char *Format, + ...) +{ + va_list Args; + int Length; + + + va_start (Args, Format); + Length = vprintf (Format, Args); + va_end (Args); + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: vfprintf * * PARAMETERS: File - File descriptor * Format - Standard printf format @@ -760,8 +853,8 @@ AcpiUtSnprintf ( ******************************************************************************/ int -AcpiUtFileVprintf ( - ACPI_FILE File, +vfprintf ( + FILE *File, const char *Format, va_list Args) { @@ -770,10 +863,10 @@ AcpiUtFileVprintf ( Flags = AcpiOsAcquireLock (AcpiGbl_PrintLock); - Length = AcpiUtVsnprintf (AcpiGbl_PrintBuffer, + Length = vsnprintf (AcpiGbl_PrintBuffer, sizeof (AcpiGbl_PrintBuffer), Format, Args); - (void) AcpiOsWriteFile (File, AcpiGbl_PrintBuffer, Length, 1); + (void) fwrite (AcpiGbl_PrintBuffer, Length, 1, File); AcpiOsReleaseLock (AcpiGbl_PrintLock, Flags); return (Length); @@ -782,7 +875,7 @@ AcpiUtFileVprintf ( /******************************************************************************* * - * FUNCTION: AcpiUtFilePrintf + * FUNCTION: fprintf * * PARAMETERS: File - File descriptor * Format, ... - Standard printf format @@ -794,8 +887,8 @@ AcpiUtFileVprintf ( ******************************************************************************/ int -AcpiUtFilePrintf ( - ACPI_FILE File, +fprintf ( + FILE *File, const char *Format, ...) { @@ -804,7 +897,7 @@ AcpiUtFilePrintf ( va_start (Args, Format); - Length = AcpiUtFileVprintf (File, Format, Args); + Length = vfprintf (File, Format, Args); va_end (Args); return (Length); |
