summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-04-25 20:49:36 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-04-25 20:49:36 +0000
commita8ac50861718f6510e9c695d539c85dbb5b4825b (patch)
tree04c06f0424c496fb1ce682450e4ec8a929565d52
parent2a5da1084107f0b6059a82e9ae7ecc5beac16f1a (diff)
Make function declaration and man page match prototype. Closes PR 3236
-rw-r--r--lib/libc/stdio/funopen.38
-rw-r--r--lib/libc/stdio/funopen.c12
2 files changed, 9 insertions, 11 deletions
diff --git a/lib/libc/stdio/funopen.3 b/lib/libc/stdio/funopen.3
index 076ccc90162..861e7415732 100644
--- a/lib/libc/stdio/funopen.3
+++ b/lib/libc/stdio/funopen.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: funopen.3,v 1.9 2000/04/20 01:39:32 aaron Exp $
+.\" $OpenBSD: funopen.3,v 1.10 2003/04/25 20:49:35 millert Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -44,11 +44,11 @@
.Sh SYNOPSIS
.Fd #include <stdio.h>
.Ft FILE *
-.Fn funopen "void *cookie" "int (*readfn)(void *, char *, int)" "int (*writefn)(void *, const char *, int)" "fpos_t (*seekfn)(void *, fpos_t, int)" "int (*closefn)(void *)"
+.Fn funopen "const void *cookie" "int (*readfn)(void *, char *, int)" "int (*writefn)(void *, const char *, int)" "fpos_t (*seekfn)(void *, fpos_t, int)" "int (*closefn)(void *)"
.Ft FILE *
-.Fn fropen "void *cookie" "int (*readfn)(void *, char *, int)"
+.Fn fropen "const void *cookie" "int (*readfn)(void *, char *, int)"
.Ft FILE *
-.Fn fwopen "void *cookie" "int (*writefn)(void *, const char *, int)"
+.Fn fwopen "const void *cookie" "int (*writefn)(void *, const char *, int)"
.Sh DESCRIPTION
The
.Fn funopen
diff --git a/lib/libc/stdio/funopen.c b/lib/libc/stdio/funopen.c
index c2fcb5461cd..3932753b7e5 100644
--- a/lib/libc/stdio/funopen.c
+++ b/lib/libc/stdio/funopen.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: funopen.c,v 1.4 2002/02/19 19:39:36 millert Exp $";
+static const char rcsid[] = "$OpenBSD: funopen.c,v 1.5 2003/04/25 20:49:35 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -43,11 +43,9 @@ static char rcsid[] = "$OpenBSD: funopen.c,v 1.4 2002/02/19 19:39:36 millert Exp
#include "local.h"
FILE *
-funopen(cookie, readfn, writefn, seekfn, closefn)
- const void *cookie;
- int (*readfn)(), (*writefn)();
- fpos_t (*seekfn)(void *cookie, fpos_t off, int whence);
- int (*closefn)();
+funopen(const void *cookie, int (*readfn)(void *, char *, int),
+ int (*writefn)(void *, const char *, int),
+ fpos_t (*seekfn)(void *, fpos_t, int), int (*closefn)(void *))
{
register FILE *fp;
int flags;
@@ -68,7 +66,7 @@ funopen(cookie, readfn, writefn, seekfn, closefn)
return (NULL);
fp->_flags = flags;
fp->_file = -1;
- fp->_cookie = (void *)cookie;
+ fp->_cookie = (void *)cookie; /* SAFE: cookie not modified */
fp->_read = readfn;
fp->_write = writefn;
fp->_seek = seekfn;