Permalink
Browse files

Stubbed the <stdio.h> puts() function and defined the EOF macro.

  • Loading branch information...
bendiken committed Nov 14, 2014
1 parent 5bdcacd commit 245141f8227d9706e6f2c978d6e9d4a98356a278
Showing with 58 additions and 3 deletions.
  1. +2 −2 TODO
  2. +11 −1 src/include/stdio.h
  3. +1 −0 src/stdio/Makefile.am
  4. +17 −0 src/stdio/puts.c
  5. +2 −0 test/stdio/.gitignore
  6. +2 −0 test/stdio/Makefile.am
  7. +12 −0 test/stdio/check-macros.c
  8. +11 −0 test/stdio/check-puts.c
View
4 TODO
@@ -5,8 +5,8 @@ Near-Term Priorities
- sys/**/crt0.S
- sys/**/__sys_exit.S
- sys/**/__sys_write.S
- <stdlib.h>: EXIT_SUCCESS
- <stdio.h>: puts()
+ <stdlib.h>: EXIT_SUCCESS
~ <stdio.h>: puts()
- Implement assert() so that the test harness can be made useful.
- <assert.h>: assert()
View
@@ -12,12 +12,22 @@
*/
#include <stdarg.h> /* for va_list */
#include <stddef.h> /* for size_t */
#include <stddef.h> /* for NULL, size_t */
/**
* C11 7.21.1.3
*/
#define EOF (-1)
#ifdef __cplusplus
extern "C" {
#endif
/**
* C11 7.21.7.9
*/
int puts(const char* str);
int snprintf(char* restrict str, size_t size, const char* restrict format, ...);
int sprintf(char* restrict str, const char* restrict format, ...);
View
@@ -1,6 +1,7 @@
noinst_LTLIBRARIES = libcstdio.la
libcstdio_la_SOURCES = \
puts.c \
snprintf.c \
sprintf.c \
vsnprintf.c \
View
@@ -0,0 +1,17 @@
/* This is free and unencumbered software released into the public domain. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
/**
* @date 2014-11-14
* @author Arto Bendiken
* @see http://libc11.org/stdio/puts.html
*/
int
puts(const char* str) {
return (void)str, EOF; // TODO
}
View
@@ -1,3 +1,5 @@
check-macros
check-puts
check-snprintf
check-sprintf
check-vsnprintf
View
@@ -5,6 +5,8 @@ AM_LDFLAGS += $(TEST_LDFLAGS)
LDADD = $(top_srcdir)/src/libc.la
check_PROGRAMS = \
check-macros \
check-puts \
check-snprintf \
check-sprintf \
check-vsnprintf \
View
@@ -0,0 +1,12 @@
/* This is free and unencumbered software released into the public domain. */
#include <assert.h> /* for assert() */
#include <stdio.h> /* for printf() */
#include <stdlib.h> /* for EXIT_SUCCESS */
int
main(void) {
(void)EOF;
return EXIT_SUCCESS;
}
View
@@ -0,0 +1,11 @@
/* This is free and unencumbered software released into the public domain. */
#include <assert.h> /* for assert() */
#include <stdio.h> /* for printf() */
#include <stdlib.h> /* for EXIT_SUCCESS */
int
main(void) {
// TODO
return EXIT_SUCCESS;
}

0 comments on commit 245141f

Please sign in to comment.