diff --git a/source/include/acclib.h b/source/include/acclib.h index e917dd88d..9fca11114 100644 --- a/source/include/acclib.h +++ b/source/include/acclib.h @@ -304,6 +304,10 @@ sprintf ( */ extern int errno; +#ifndef EOF +#define EOF (-1) +#endif + int vprintf ( const char *Format, @@ -358,6 +362,15 @@ fseek ( long ftell ( FILE *File); + +int +fgetc ( + FILE *File); + +int +fputc ( + FILE *File, + char c); #endif #endif /* _ACCLIB_H */ diff --git a/source/os_specific/efi/oseficlib.c b/source/os_specific/efi/oseficlib.c index b0956ce90..91c85a863 100644 --- a/source/os_specific/efi/oseficlib.c +++ b/source/os_specific/efi/oseficlib.c @@ -335,6 +335,76 @@ fclose ( } +/******************************************************************************* + * + * FUNCTION: fgetc + * + * PARAMETERS: File - File descriptor + * + * RETURN: The character read or EOF on the end of the file or error + * + * DESCRIPTION: Read a character from the file. + * + ******************************************************************************/ + +int +fgetc ( + FILE *File) +{ + UINT8 Byte; + int Length; + + + Length = fread (ACPI_CAST_PTR (void, &Byte), 1, 1, File); + if (Length == 0) + { + Length = EOF; + } + else if (Length == 1) + { + Length = (int) Byte; + } + + return (Length); +} + + +/******************************************************************************* + * + * FUNCTION: fputc + * + * PARAMETERS: File - File descriptor + * c - Character byte + * + * RETURN: The character written or EOF on the end of the file or error + * + * DESCRIPTION: Write a character to the file. + * + ******************************************************************************/ + +int +fputc ( + FILE *File, + char c) +{ + UINT8 Byte = (UINT8) c; + int Length; + + + Length = fwrite (ACPI_CAST_PTR (void, &Byte), 1, 1, File); + if (Length == 0) + { + Length = EOF; + } + else if (Length == 1) + { + Length = (int) Byte; + } + + return (Length); +} + + /******************************************************************************* * * FUNCTION: fread