Introduce <stdio.h>

This commit is contained in:
Pierre Pronchery 2018-04-05 03:08:56 +02:00
parent cbe0064bac
commit 186cfff0f1
4 changed files with 43 additions and 3 deletions

View File

@ -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

14
include/stdio.h Normal file
View File

@ -0,0 +1,14 @@
/* $Id$ */
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
/* 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 */

View File

@ -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

23
src/lib/stdio.c Normal file
View File

@ -0,0 +1,23 @@
/* $Id$ */
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS uKernel */
#include <string.h>
#include <stdio.h>
#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;
}