From: David van Moolenbroek Date: Fri, 23 Apr 2010 20:23:33 +0000 (+0000) Subject: intercept puts() in libsys, for gcc X-Git-Tag: v3.1.7~127 X-Git-Url: http://zhaoyanbai.com/repos/%22../static/icons/ChangeLog.html?a=commitdiff_plain;h=aacbfc41ccc009feabac4944fc4774f643e1f378;p=minix.git intercept puts() in libsys, for gcc --- diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 126bdbca2..3ea87fc7a 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -98,6 +98,7 @@ SRCS= \ asynsend.c \ kprintf.c \ kputc.c \ + kputs.c \ tickdelay.c \ get_randomness.c \ getidle.c \ diff --git a/lib/libsys/kputs.c b/lib/libsys/kputs.c new file mode 100644 index 000000000..e05c9bf45 --- /dev/null +++ b/lib/libsys/kputs.c @@ -0,0 +1,24 @@ +/* system services puts() + * + * This is here because gcc converts printf() calls without actual formatting + * in the format string, to puts() calls. While that "feature" can be disabled + * with the -fno-builtin-printf gcc flag, we still don't want the resulting + * mayhem to occur in system servers even when that flag is forgotten. + */ + +#include + +/* puts() uses kputc() to print characters. */ +void kputc(int c); + +int puts(const char *s) +{ + + for (; *s; s++) + kputc(*s); + + kputc('\n'); + kputc('\0'); + + return 0; +}