libstand functions not ansi-c compiliant

Michael Reifenberger mike at Reifenberger.com
Wed Jun 8 07:54:07 GMT 2005


Hi,
as it seems are a few functions as defined/implemented in libstand
not ansi-c compiant: putchar, vprintf, vsprintf.
They are defined to return void instead of int.

The following patch tries to correct that.
Any objections to -commit?



Index: printf.c
===================================================================
RCS file: /home/ncvs/src/lib/libstand/printf.c,v
retrieving revision 1.8
diff -u -r1.8 printf.c
--- printf.c	6 Apr 2003 05:25:48 -0000	1.8
+++ printf.c	8 Jun 2005 07:48:23 -0000
@@ -75,11 +75,13 @@
  	return retval;
  }

-void
+int
  vprintf(const char *fmt, va_list ap)
  {
+	int retval;

  	kvprintf(fmt, putchar, NULL, 10, ap);
+	return(retval);
  }

  int
@@ -95,13 +97,14 @@
  	return retval;
  }

-void
+int
  vsprintf(char *buf, const char *cfmt, va_list ap)
  {
  	int	retval;

  	retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap);
  	buf[retval] = '\0';
+	return(retval);
  }

  /*
Index: stand.h
===================================================================
RCS file: /home/ncvs/src/lib/libstand/stand.h,v
retrieving revision 1.41
diff -u -r1.41 stand.h
--- stand.h	17 May 2005 17:46:29 -0000	1.41
+++ stand.h	8 Jun 2005 07:48:24 -0000
@@ -248,9 +248,9 @@
  extern char	*getdisklabel(const char *, struct disklabel *);

  extern int	printf(const char *fmt, ...) __printflike(1, 2);
-extern void	vprintf(const char *fmt, __va_list);
+extern int	vprintf(const char *fmt, __va_list);
  extern int	sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3);
-extern void	vsprintf(char *buf, const char *cfmt, __va_list);
+extern int	vsprintf(char *buf, const char *cfmt, __va_list);

  extern void	twiddle(void);

@@ -369,7 +369,7 @@
   */
  extern int		getchar(void);
  extern int		ischar(void);
-extern void		putchar(int);
+extern int		putchar(int);
  extern int		devopen(struct open_file *, const char *, const char **);
  extern int		devclose(struct open_file *f);
  extern void		panic(const char *, ...) __dead2 __printflike(1, 2);


Bye/2
---
Michael Reifenberger, Business Development Manager SAP-Basis, Plaut Consulting
Comp: Michael.Reifenberger at plaut.de | Priv: Michael at Reifenberger.com
       http://www.plaut.de           |       http://www.Reifenberger.com



More information about the freebsd-standards mailing list