-/* $OpenBSD: stdio.h,v 1.55 2022/01/05 20:57:27 millert Exp $ */
+/* $OpenBSD: stdio.h,v 1.56 2024/08/07 05:15:28 guenther Exp $ */
/* $NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $ */
/*-
char *fgets(char *, int, FILE *)
__attribute__((__bounded__ (__string__,1,2)));
FILE *fopen(const char *, const char *);
-int fprintf(FILE *, const char *, ...);
+int fprintf(FILE *, const char * __restrict, ...);
int fputc(int, FILE *);
int fputs(const char *, FILE *);
size_t fread(void *, size_t, size_t, FILE *)
extern char *sys_errlist[];
#endif
void perror(const char *);
-int printf(const char *, ...);
+int printf(const char * __restrict, ...);
int putc(int, FILE *);
int putchar(int);
int puts(const char *);
int scanf(const char *, ...);
void setbuf(FILE *, char *);
int setvbuf(FILE *, char *, int, size_t);
-int sprintf(char *, const char *, ...);
+int sprintf(char * __restrict, const char * __restrict, ...);
int sscanf(const char *, const char *, ...);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
-int vfprintf(FILE *, const char *, __va_list);
-int vprintf(const char *, __va_list);
-int vsprintf(char *, const char *, __va_list);
+int vfprintf(FILE *, const char * __restrict, __va_list);
+int vprintf(const char * __restrict, __va_list);
+int vsprintf(char * __restrict, const char * __restrict, __va_list);
#if __POSIX_VISIBLE >= 200809
int vdprintf(int, const char * __restrict, __va_list)
__attribute__((__format__ (printf, 2, 0)))
#endif
#if __ISO_C_VISIBLE >= 1999 || __XPG_VISIBLE >= 500 || __BSD_VISIBLE
-int snprintf(char *, size_t, const char *, ...)
+int snprintf(char * __restrict, size_t, const char * __restrict, ...)
__attribute__((__format__ (printf, 3, 4)))
__attribute__((__nonnull__ (3)))
__attribute__((__bounded__ (__string__,1,2)));
-int vsnprintf(char *, size_t, const char *, __va_list)
+int vsnprintf(char * __restrict, size_t, const char * __restrict,
+ __va_list)
__attribute__((__format__ (printf, 3, 0)))
__attribute__((__nonnull__ (3)))
__attribute__((__bounded__(__string__,1,2)));
#if __XPG_VISIBLE
char *tempnam(const char *, const char *);
#endif
+
+#if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE
+int asprintf(char ** __restrict, const char * __restrict, ...)
+ __attribute__((__format__ (printf, 2, 3)))
+ __attribute__((__nonnull__ (2)));
+int vasprintf(char ** __restrict, const char * __restrict, __va_list)
+ __attribute__((__format__ (printf, 2, 0)))
+ __attribute__((__nonnull__ (2)));
+#endif /* __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE */
__END_DECLS
#endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */
*/
#if __BSD_VISIBLE
__BEGIN_DECLS
-int asprintf(char **, const char *, ...)
- __attribute__((__format__ (printf, 2, 3)))
- __attribute__((__nonnull__ (2)));
char *fgetln(FILE *, size_t *);
int fpurge(FILE *);
int getw(FILE *);
int putw(int, FILE *);
void setbuffer(FILE *, char *, int);
int setlinebuf(FILE *);
-int vasprintf(char **, const char *, __va_list)
- __attribute__((__format__ (printf, 2, 0)))
- __attribute__((__nonnull__ (2)));
__END_DECLS
/*
-.\" $OpenBSD: printf.3,v 1.93 2022/08/04 06:20:24 jsg Exp $
+.\" $OpenBSD: printf.3,v 1.94 2024/08/07 05:15:28 guenther Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: August 4 2022 $
+.Dd $Mdocdate: August 7 2024 $
.Dt PRINTF 3
.Os
.Sh NAME
.Sh SYNOPSIS
.In stdio.h
.Ft int
-.Fn printf "const char *format" ...
+.Fn printf "const char * restrict format" ...
.Ft int
-.Fn fprintf "FILE *stream" "const char *format" ...
+.Fn fprintf "FILE *stream" "const char * restrict format" ...
.Ft int
-.Fn sprintf "char *str" "const char *format" ...
+.Fn sprintf "char * restrict str" "const char * restrict format" ...
.Ft int
-.Fn snprintf "char *str" "size_t size" "const char *format" ...
+.Fn snprintf "char * restrict str" "size_t size" "const char * restrict format" ...
.Ft int
-.Fn asprintf "char **ret" "const char *format" ...
+.Fn asprintf "char ** restrict ret" "const char * restrict format" ...
.Ft int
.Fn dprintf "int fd" "const char * restrict format" ...
.In stdarg.h
.In stdio.h
.Ft int
-.Fn vprintf "const char *format" "va_list ap"
+.Fn vprintf "const char * restrict format" "va_list ap"
.Ft int
-.Fn vfprintf "FILE *stream" "const char *format" "va_list ap"
+.Fn vfprintf "FILE *stream" "const char * restrict format" "va_list ap"
.Ft int
-.Fn vsprintf "char *str" "const char *format" "va_list ap"
+.Fn vsprintf "char * restrict str" "const char * restrict format" "va_list ap"
.Ft int
-.Fn vsnprintf "char *str" "size_t size" "const char *format" "va_list ap"
+.Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap"
.Ft int
-.Fn vasprintf "char **ret" "const char *format" "va_list ap"
+.Fn vasprintf "char ** restrict ret" "const char * restrict format" "va_list ap"
.Ft int
.Fn vdprintf "int fd" "const char * restrict format" "va_list ap"
.Sh DESCRIPTION
functions conform to
.St -isoC-99 .
The
-.Fn dprintf
+.Fn dprintf ,
+.Fn vdprintf ,
+.Fn asprintf ,
and
-.Fn vdprintf
+.Fn vasprintf
functions conform to
-.St -p1003.1-2008 .
+.St -p1003.1-2024 .
.Sh HISTORY
The predecessors
.Fn ftoa