summaryrefslogtreecommitdiff
path: root/lib/libpthread/stdio
diff options
context:
space:
mode:
authorPeter Galbavy <peter@cvs.openbsd.org>1998-07-21 13:54:06 +0000
committerPeter Galbavy <peter@cvs.openbsd.org>1998-07-21 13:54:06 +0000
commit2979ca23937f55308c22a0cf2acb66a4525843c0 (patch)
tree028173e908f14aa9b6c604cbab6f002858dbe4c4 /lib/libpthread/stdio
parent0294ed9251849ce79ab3d4cc45841a9f6de82844 (diff)
fix up those 13 broken merges
Diffstat (limited to 'lib/libpthread/stdio')
-rw-r--r--lib/libpthread/stdio/fprintf.c3
-rw-r--r--lib/libpthread/stdio/fscanf.c3
-rw-r--r--lib/libpthread/stdio/fseek.c18
-rw-r--r--lib/libpthread/stdio/ftell.c15
-rw-r--r--lib/libpthread/stdio/funopen.c17
-rw-r--r--lib/libpthread/stdio/scanf.c5
-rw-r--r--lib/libpthread/stdio/snprintf.c4
-rw-r--r--lib/libpthread/stdio/sprintf.c6
-rw-r--r--lib/libpthread/stdio/sscanf.c3
-rw-r--r--lib/libpthread/stdio/tempnam.c4
-rw-r--r--lib/libpthread/stdio/vfscanf.c5
11 files changed, 50 insertions, 33 deletions
diff --git a/lib/libpthread/stdio/fprintf.c b/lib/libpthread/stdio/fprintf.c
index 6101c6d2860..ab159072863 100644
--- a/lib/libpthread/stdio/fprintf.c
+++ b/lib/libpthread/stdio/fprintf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)fprintf.c 5.6 (Berkeley) 1/20/91";*/
-static char *rcsid = "$Id: fprintf.c,v 1.2 1997/07/25 20:30:20 mickey Exp $";
+static char *rcsid = "$Id: fprintf.c,v 1.3 1998/07/21 13:53:53 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <pthread.h>
diff --git a/lib/libpthread/stdio/fscanf.c b/lib/libpthread/stdio/fscanf.c
index 2c0f44e7e89..9a946124fbd 100644
--- a/lib/libpthread/stdio/fscanf.c
+++ b/lib/libpthread/stdio/fscanf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)fscanf.c 5.1 (Berkeley) 1/20/91";*/
-static char *rcsid = "$Id: fscanf.c,v 1.2 1997/07/25 20:30:21 mickey Exp $";
+static char *rcsid = "$Id: fscanf.c,v 1.3 1998/07/21 13:53:54 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <pthread.h>
diff --git a/lib/libpthread/stdio/fseek.c b/lib/libpthread/stdio/fseek.c
index 70ea8bea384..15176414f98 100644
--- a/lib/libpthread/stdio/fseek.c
+++ b/lib/libpthread/stdio/fseek.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,9 +37,10 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)fseek.c 5.7 (Berkeley) 2/24/91";*/
-static char *rcsid = "$Id: fseek.c,v 1.2 1997/07/25 20:30:22 mickey Exp $";
+static char *rcsid = "$Id: fseek.c,v 1.3 1998/07/21 13:53:56 peter Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -69,8 +71,7 @@ fseek(fp, offset, whence)
int havepos;
/* make sure stdio is set up */
- if (!__sdidinit)
- __sinit();
+ __sinit ();
flockfile(fp);
@@ -88,10 +89,11 @@ fseek(fp, offset, whence)
if (fp->_flags & __SOFF)
curoff = fp->_offset;
else {
- curoff = __sseek(fp, (fpos_t)0, SEEK_CUR);
- if (curoff == -1L)
+ curoff = __sseek(fp, (off_t)0, SEEK_CUR);
+ if (curoff == -1L) {
funlockfile(fp);
return (EOF);
+ }
}
if (fp->_flags & __SRD) {
curoff -= fp->_r;
@@ -155,7 +157,7 @@ fseek(fp, offset, whence)
if (fp->_flags & __SOFF)
curoff = fp->_offset;
else {
- curoff = __sseek(fp, 0L, SEEK_CUR);
+ curoff = __sseek(fp, (off_t)0, SEEK_CUR);
if (curoff == POS_ERR)
goto dumb;
}
@@ -208,7 +210,7 @@ fseek(fp, offset, whence)
* ensures that we only read one block, rather than two.
*/
curoff = target & ~(fp->_blksize - 1);
- if (__sseek(fp, 0L, SEEK_CUR) != POS_ERR) {
+ if (__sseek(fp, (off_t)curoff, SEEK_SET) != POS_ERR) {
fp->_r = 0;
fp->_p = fp->_bf._base;
if (HASUB(fp))
@@ -230,7 +232,7 @@ fseek(fp, offset, whence)
* do it. Allow the seek function to change fp->_bf._base.
*/
dumb:
- if (__sflush(fp) || __sseek(fp, offset, whence) == POS_ERR) {
+ if (__sflush(fp) || __sseek(fp, (off_t)offset, whence) == POS_ERR) {
funlockfile(fp);
return (EOF);
}
diff --git a/lib/libpthread/stdio/ftell.c b/lib/libpthread/stdio/ftell.c
index 57dce109ac9..8d3f228bbd0 100644
--- a/lib/libpthread/stdio/ftell.c
+++ b/lib/libpthread/stdio/ftell.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)ftell.c 5.4 (Berkeley) 2/5/91";*/
-static char *rcsid = "$Id: ftell.c,v 1.4 1997/02/28 16:22:31 kstailey Exp $";
+static char *rcsid = "$Id: ftell.c,v 1.5 1998/07/21 13:53:57 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <pthread.h>
@@ -51,18 +52,18 @@ long
ftell(fp)
register const FILE *fp;
{
- register fpos_t pos;
+ long pos;
- flockfile(fp);
+ flockfile((FILE *)fp);
/*
* Find offset of underlying I/O object, then
* adjust for buffered bytes.
*/
- if (fp->_flags & __SOFF)
+ if (fp->_flags & __SOFF) {
pos = fp->_offset;
- else {
- pos = lseek(fp->_file, (fpos_t)0, SEEK_CUR);
+ } else {
+ pos = (long)__sseek((FILE *)fp, (off_t)0, SEEK_CUR);
}
if (pos != -1L) {
@@ -84,6 +85,6 @@ ftell(fp)
pos += fp->_p - fp->_bf._base;
}
}
- funlockfile(fp);
+ funlockfile((FILE *)fp);
return (pos);
}
diff --git a/lib/libpthread/stdio/funopen.c b/lib/libpthread/stdio/funopen.c
index c77aaf47a90..8a0079871f1 100644
--- a/lib/libpthread/stdio/funopen.c
+++ b/lib/libpthread/stdio/funopen.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,10 +37,12 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)funopen.c 5.2 (Berkeley) 2/5/91";*/
-static char *rcsid = "$Id: funopen.c,v 1.2 1997/07/25 20:30:22 mickey Exp $";
+static char *rcsid = "$Id: funopen.c,v 1.3 1998/07/21 13:53:58 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <pthread.h>
+#include <stdlib.h>
+#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include "local.h"
@@ -74,20 +77,22 @@ funopen(cookie, readfn, writefn, seekfn, closefn)
}
if (fd_ops = (struct fd_ops*)malloc(sizeof(struct fd_ops))) {
- if ((!(fd = fd_allocate())) < OK) {
+ if ((fd = fd_allocate()) >= OK) {
/* Set functions */
- fd_ops->seek = seekfn;
- fd_ops->read = readfn;
- fd_ops->write = writefn;
+ fd_ops->seek = (off_t(*)())seekfn;
+ fd_ops->read = (pthread_ssize_t(*)())readfn;
+ fd_ops->write = (pthread_ssize_t(*)())writefn;
fd_ops->close = closefn;
+ fd_ops->use_kfds = 2;
/* Alloc space for funtion pointer table */
fd_table[fd]->type = FD_HALF_DUPLEX;
fd_table[fd]->ops = fd_ops;
+ fd_table[fd]->flags = O_RDWR;
/* Save the cookie, it's important */
- fd_table[fd]->fd.ptr = cookie;
+ fd_table[fd]->fd.ptr = (void *)cookie;
if (fp = fdopen(fd, flags))
return(fp);
diff --git a/lib/libpthread/stdio/scanf.c b/lib/libpthread/stdio/scanf.c
index adaa4a0a78a..6d023a4bba2 100644
--- a/lib/libpthread/stdio/scanf.c
+++ b/lib/libpthread/stdio/scanf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)scanf.c 5.3 (Berkeley) 1/20/91";*/
-static char *rcsid = "$Id: scanf.c,v 1.2 1997/07/25 20:30:23 mickey Exp $";
+static char *rcsid = "$Id: scanf.c,v 1.3 1998/07/21 13:53:59 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <pthread.h>
@@ -65,7 +66,7 @@ scanf(fmt, va_alist)
#endif
flockfile(stdin);
ret = __svfscanf(stdin, fmt, ap);
- flockfile(stdin);
+ funlockfile(stdin);
va_end(ap);
return (ret);
}
diff --git a/lib/libpthread/stdio/snprintf.c b/lib/libpthread/stdio/snprintf.c
index ae3f03d4530..a009da8f3aa 100644
--- a/lib/libpthread/stdio/snprintf.c
+++ b/lib/libpthread/stdio/snprintf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)snprintf.c 5.1 (Berkeley) 1/20/91";*/
-static char *rcsid = "$Id: snprintf.c,v 1.2 1997/07/25 20:30:23 mickey Exp $";
+static char *rcsid = "$Id: snprintf.c,v 1.3 1998/07/21 13:54:00 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -67,6 +68,7 @@ snprintf(str, n, fmt, va_alist)
#else
va_start(ap);
#endif
+ f._file = -1;
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *)str;
f._bf._size = f._w = n - 1;
diff --git a/lib/libpthread/stdio/sprintf.c b/lib/libpthread/stdio/sprintf.c
index d93cfc46285..6d6906967fc 100644
--- a/lib/libpthread/stdio/sprintf.c
+++ b/lib/libpthread/stdio/sprintf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,16 +37,16 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)sprintf.c 5.7 (Berkeley) 1/20/91";*/
-static char *rcsid = "$Id: sprintf.c,v 1.2 1997/07/25 20:30:24 mickey Exp $";
+static char *rcsid = "$Id: sprintf.c,v 1.3 1998/07/21 13:54:01 peter Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <limits.h>
#include <stdio.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include <limits.h>
#include "local.h"
#ifdef __STDC__
@@ -61,6 +62,7 @@ sprintf(str, fmt, va_alist)
va_list ap;
FILE f;
+ f._file = -1;
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *)str;
f._bf._size = f._w = INT_MAX;
diff --git a/lib/libpthread/stdio/sscanf.c b/lib/libpthread/stdio/sscanf.c
index 1ca458fb4d2..cd3db6640a4 100644
--- a/lib/libpthread/stdio/sscanf.c
+++ b/lib/libpthread/stdio/sscanf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)sscanf.c 5.1 (Berkeley) 1/20/91";*/
-static char *rcsid = "$Id: sscanf.c,v 1.2 1997/07/25 20:30:24 mickey Exp $";
+static char *rcsid = "$Id: sscanf.c,v 1.3 1998/07/21 13:54:02 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
diff --git a/lib/libpthread/stdio/tempnam.c b/lib/libpthread/stdio/tempnam.c
index 584c8f9442e..4a8107a05ff 100644
--- a/lib/libpthread/stdio/tempnam.c
+++ b/lib/libpthread/stdio/tempnam.c
@@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)tempnam.c 5.1 (Berkeley) 2/22/91";*/
-static char *rcsid = "$Id: tempnam.c,v 1.3 1997/02/15 04:57:42 angelos Exp $";
+static char *rcsid = "$Id: tempnam.c,v 1.4 1998/07/21 13:54:04 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -41,7 +41,7 @@ static char *rcsid = "$Id: tempnam.c,v 1.3 1997/02/15 04:57:42 angelos Exp $";
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <paths.h>
+/* #include <paths.h> */
char *
tempnam(dir, pfx)
diff --git a/lib/libpthread/stdio/vfscanf.c b/lib/libpthread/stdio/vfscanf.c
index afdd7604360..723e37c5a7a 100644
--- a/lib/libpthread/stdio/vfscanf.c
+++ b/lib/libpthread/stdio/vfscanf.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1993, 1994 Chris Provenzano.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -36,7 +37,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)vfscanf.c 5.7 (Berkeley) 12/14/92";*/
-static char *rcsid = "$Id: vfscanf.c,v 1.2 1997/07/25 20:30:25 mickey Exp $";
+static char *rcsid = "$Id: vfscanf.c,v 1.3 1998/07/21 13:54:05 peter Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -98,7 +99,7 @@ static u_char *__sccl();
__svfscanf(fp, fmt0, ap)
register FILE *fp;
char const *fmt0;
- va_list ap;
+ pthread_va_list ap;
{
register u_char *fmt = (u_char *)fmt0;
register int c; /* character from format, or conversion */