From 186cfff0f146bc16bd18a11a49c4fabd3ff86bdc Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 5 Apr 2018 03:08:56 +0200 Subject: [PATCH] Introduce --- include/project.conf | 2 +- include/stdio.h | 14 ++++++++++++++ src/lib/project.conf | 7 +++++-- src/lib/stdio.c | 23 +++++++++++++++++++++++ 4 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 include/stdio.h create mode 100644 src/lib/stdio.c diff --git a/include/project.conf b/include/project.conf index 2eea74b..0cbc322 100644 --- a/include/project.conf +++ b/include/project.conf @@ -1,2 +1,2 @@ subdirs=sys -dist=Makefile,errno.h,stdbool.h,stddef.h,stdint.h,stdlib.h,string.h,unistd.h +dist=Makefile,errno.h,stdbool.h,stddef.h,stdint.h,stdio.h,stdlib.h,string.h,unistd.h diff --git a/include/stdio.h b/include/stdio.h new file mode 100644 index 0000000..9fe2e2b --- /dev/null +++ b/include/stdio.h @@ -0,0 +1,14 @@ +/* $Id$ */ +/* Copyright (c) 2018 Pierre Pronchery */ +/* This file is part of DeforaOS uKernel */ + + + +#ifndef UKERNEL_STDIO_H +# define UKERNEL_STDIO_H + + +/* prototypes */ +int puts(char const * string); + +#endif /* !UKERNEL_STDIO_H */ diff --git a/src/lib/project.conf b/src/lib/project.conf index c65d988..b5b1338 100644 --- a/src/lib/project.conf +++ b/src/lib/project.conf @@ -1,5 +1,5 @@ targets=libuKernel -cppflags_force=-nostdinc -isystem ../../include +cppflags_force=-nostdinc -isystem ../../include -I.. cflags_force=`../../tools/platform.sh -V LIBUKERNEL_CFLAGS -C "$$ARCH"` cflags=-W -Wall -g -O2 ldflags_force=`../../tools/platform.sh -V LIBUKERNEL_LDFLAGS -C "$$ARCH"` @@ -7,7 +7,7 @@ dist=Makefile,ssp.h [libuKernel] type=library -sources=errno.c,ssp.c,stdlib.c,string.c +sources=errno.c,ssp.c,stdio.c,stdlib.c,string.c [errno.c] depends=../../include/errno.h @@ -15,6 +15,9 @@ depends=../../include/errno.h [ssp.c] depends=../../include/stdlib.h,../drivers/console.h,ssp.h +[stdio.c] +depends=../../include/stdio.h,../../include/string.h + [stdlib.c] depends=../../include/stdlib.h,../../include/unistd.h diff --git a/src/lib/stdio.c b/src/lib/stdio.c new file mode 100644 index 0000000..70d843f --- /dev/null +++ b/src/lib/stdio.c @@ -0,0 +1,23 @@ +/* $Id$ */ +/* Copyright (c) 2018 Pierre Pronchery */ +/* This file is part of DeforaOS uKernel */ + + + +#include +#include +#include "drivers/console.h" + + +/* public */ +/* functions */ +/* puts */ +int puts(char const * string) +{ + size_t len; + + len = strlen(string); + /* XXX assumes the whole string was output */ + console_print(NULL, string, len); + return len; +}