changeset 4:5c7b3d5d5702

libprintf compiles with Anshit C GCC
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 29 Apr 2013 07:19:34 +0000
parents 45bf8af5f061
children 4a7a325ed1b6
files loadagent/libprintf/doprnt.c loadagent/libprintf/printf.c loadagent/libprintf/sprintf.c loadagent/libprintf/vprintf.c loadagent/libprintf/vsprintf.c
diffstat 5 files changed, 12 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/loadagent/libprintf/doprnt.c	Mon Apr 29 07:00:22 2013 +0000
+++ b/loadagent/libprintf/doprnt.c	Mon Apr 29 07:19:34 2013 +0000
@@ -2,13 +2,12 @@
 
 #include <sys/types.h>
 #include <ctype.h>
-#include <varargs.h>
+#include <stdarg.h>
 
 #define	PUTC(ch)	((*outfunc)((ch), outfunc_param))
 
 #define	ARG() \
-	_ulong = flags&LONGINT ? va_arg(argp, long) : \
-	    flags&SHORTINT ? va_arg(argp, short) : va_arg(argp, int);
+	_ulong = flags&LONGINT ? va_arg(argp, long) : va_arg(argp, int);
 
 #define	BUF	256
 
--- a/loadagent/libprintf/printf.c	Mon Apr 29 07:00:22 2013 +0000
+++ b/loadagent/libprintf/printf.c	Mon Apr 29 07:19:34 2013 +0000
@@ -1,17 +1,14 @@
-#include <varargs.h>
+#include <stdarg.h>
 
 extern void putchar();
 
 int
-printf(va_alist)
-	va_dcl
+printf(char *fmt, ...)
 {
 	va_list ap;
-	char *fmt;
 	int len;
 
-	va_start(ap);
-	fmt = va_arg(ap, char *);
+	va_start(ap, fmt);
 	len = _doprnt(fmt, ap, &putchar);
 	va_end(ap);
 	return(len);
--- a/loadagent/libprintf/sprintf.c	Mon Apr 29 07:00:22 2013 +0000
+++ b/loadagent/libprintf/sprintf.c	Mon Apr 29 07:19:34 2013 +0000
@@ -1,21 +1,18 @@
-#include <varargs.h>
+#include <stdarg.h>
 
 extern void _sprintf_putchar();
 
 int
-sprintf(va_alist)
-	va_dcl
+sprintf(char *strdest, char *fmt, ...)
 {
 	va_list ap;
 	char *strptr;
-	char *fmt;
 	int len;
 
-	va_start(ap);
-	strptr = va_arg(ap, char *);
-	fmt = va_arg(ap, char *);
+	strptr = strdest;
+	va_start(ap, fmt);
 	len = _doprnt(fmt, ap, &_sprintf_putchar, &strptr);
+	va_end(ap);
 	*strptr = '\0';
-	va_end(ap);
 	return(len);
 }
--- a/loadagent/libprintf/vprintf.c	Mon Apr 29 07:00:22 2013 +0000
+++ b/loadagent/libprintf/vprintf.c	Mon Apr 29 07:19:34 2013 +0000
@@ -1,4 +1,4 @@
-#include <varargs.h>
+#include <stdarg.h>
 
 extern void putchar();
 
--- a/loadagent/libprintf/vsprintf.c	Mon Apr 29 07:00:22 2013 +0000
+++ b/loadagent/libprintf/vsprintf.c	Mon Apr 29 07:19:34 2013 +0000
@@ -1,4 +1,4 @@
-#include <varargs.h>
+#include <stdarg.h>
 
 extern void _sprintf_putchar();