[lib][stdio] fix the build after -fbuiltin and io changes

This commit is contained in:
Travis Geiselbrecht
2015-12-15 15:07:53 -08:00
parent 6b480fd051
commit a7496980c0
6 changed files with 25 additions and 14 deletions

View File

@@ -18,6 +18,6 @@ MODULE_SRCS += \
MODULE_ARM_OVERRIDE_SRCS := \
MODULE_COMPILEFLAGS += -Wno-format
MODULE_COMPILEFLAGS += -Wno-format -fno-builtin
include make/module.mk

View File

@@ -267,9 +267,7 @@ static int read_debug_line(const char **outbuffer, void *cookie)
case 0x8:
if (pos > 0) {
pos--;
fputc('\b', stdout);
putchar(' ');
fputc('\b', stdout); // move to the left one
fputs("\b \b", stdout); // wipe out a character
}
break;
@@ -301,9 +299,7 @@ static int read_debug_line(const char **outbuffer, void *cookie)
if (pos > 0) {
pos--;
if (echo) {
fputc('\b', stdout); // move to the left one
putchar(' ');
fputc('\b', stdout); // move to the left one
fputs("\b \b", stdout); // wipe out a character
}
}
break;
@@ -314,9 +310,7 @@ static int read_debug_line(const char **outbuffer, void *cookie)
while (pos > 0) {
pos--;
if (echo) {
fputc('\b', stdout); // move to the left one
putchar(' ');
fputc('\b', stdout); // move to the left one
fputs("\b \b", stdout); // wipe out a character
}
}
@@ -825,9 +819,7 @@ static void read_line_panic(char* buffer, const size_t len, FILE* panic_fd)
case 0x8:
if (pos > 0) {
pos--;
fputc('\b', stdout);
fputc(' ', panic_fd);
fputc('\b', stdout); // move to the left one
fputs("\b \b", panic_fd); // wipe out a character
}
break;
default:

View File

@@ -231,6 +231,7 @@ int fclose(FILE *stream)
return 0;
}
#if 0
size_t fread(void *ptr, size_t size, size_t count, FILE *stream)
{
FRESULT res;
@@ -256,6 +257,7 @@ size_t fwrite(const void *ptr, size_t size, size_t count, FILE *stream)
return bwrite;
}
#endif
int fflush(FILE *stream)
{

View File

@@ -32,6 +32,7 @@
#include <debug.h>
#include <assert.h>
#include <sys/io.h>
#include <lk/init.h>
#include <lib/gfx.h>
#include <lib/gfxconsole.h>

View File

@@ -53,6 +53,22 @@ int fputs(const char *s, FILE *fp)
return fp->write(fp->ctx, s, len);
}
size_t fwrite(const void *ptr, size_t size, size_t count, FILE *fp)
{
size_t bytes_written;
if (size == 0 || count == 0)
return 0;
// fast path for size == 1
if (likely(size == 1)) {
return fp->write(fp->ctx, ptr, count);
}
bytes_written = fp->write(fp->ctx, ptr, size * count);
return bytes_written / size;
}
int getc(FILE *fp)
{
return fp->fgetc(fp->ctx);

View File

@@ -23,7 +23,7 @@
*/
#include <malloc.h>
#include <printf.h>
#include <stdio.h>
#include <string.h>
#include <dev/udc.h>