dprintf

Jeff Johnston jjohnstn@redhat.com
Mon Oct 3 17:04:00 GMT 2005


Shaun,

  A number of problems with this patch.  First of all, no licensing 
information.  Secondly, it appears you have essentially copied the gnu 
code you posted earlier which will have a GPL license.  Thirdly, you 
haven't addressed reentrancy in your patch and you're not using the 
newlib function define macros nor have you added any documentation.

-- Jeff J.
Shaun Jackman wrote:

>2005-09-29  Shaun Jackman  <sjackman@gmail.com>
>
>	* newlib/libc/include/stdio.h (dprintf): New declaration.
>	(vdprintf): Ditto.
>	* newlib/libc/stdio/Makefile.am (GENERAL_SOURCES): Add dprintf.c.
>	* newlib/libc/stdio/dprintf.c: New file.
>
>diff -u -r1.32 stdio.h
>--- newlib/libc/include/stdio.h	2 Sep 2005 15:39:29 -0000	1.32
>+++ newlib/libc/include/stdio.h	29 Sep 2005 19:23:25 -0000
>@@ -229,6 +229,7 @@
> #ifndef _REENT_ONLY
> int	_EXFUN(asiprintf, (char **, const char *, ...));
> int	_EXFUN(asprintf, (char **, const char *, ...));
>+int	_EXFUN(dprintf, (int, const char *, ...));
> int	_EXFUN(fcloseall, (_VOID));
> int	_EXFUN(fiprintf, (FILE *, const char *, ...));
> int	_EXFUN(iprintf, (const char *, ...));
>@@ -238,6 +239,7 @@
> char *	_EXFUN(tempnam, (const char *, const char *));
> int	_EXFUN(vasiprintf, (char **, const char *, __VALIST));
> int	_EXFUN(vasprintf, (char **, const char *, __VALIST));
>+int	_EXFUN(vdprintf, (int, const char *, __VALIST));
> int	_EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST));
> int	_EXFUN(vsnprintf, (char *, size_t, const char *, __VALIST));
> int	_EXFUN(vfiprintf, (FILE *, const char *, __VALIST));
>Index: newlib/libc/stdio/Makefile.am
>===================================================================
>RCS file: /cvs/src/src/newlib/libc/stdio/Makefile.am,v
>retrieving revision 1.19
>diff -u -r1.19 Makefile.am
>--- newlib/libc/stdio/Makefile.am	24 Nov 2004 22:31:05 -0000	1.19
>+++ newlib/libc/stdio/Makefile.am	29 Sep 2005 19:23:25 -0000
>@@ -6,6 +6,7 @@
>
> GENERAL_SOURCES = \
> 	clearerr.c 			\
>+	dprintf.c			\
> 	fclose.c 			\
> 	fdopen.c 			\
> 	feof.c 				\
>--- /dev/null	2005-09-03 00:09:12.000000000 -0600
>+++ newlib/libc/stdio/dprintf.c	2005-09-29 13:18:05.000000000 -0600
>@@ -0,0 +1,23 @@
>+#include <stdarg.h>
>+#include <stdio.h>
>+#include <unistd.h>
>+
>+int vdprintf(int fd, const char *format, va_list ap)
>+{
>+	char *p;
>+	int n = vasprintf(&p, format, ap);
>+	if (n == -1) return -1;
>+	n = write(fd, p, n);
>+	free(p);
>+	return n;
>+}
>+
>+int dprintf(int fd, const char *format, ...)
>+{
>+	va_list ap;
>+	int n;
>+	va_start(ap, format);
>+	n = vdprintf(fd, format, ap);
>+	va_end(ap);
>+	return n;
>+}
>  
>



More information about the Newlib mailing list