stdio.c (50476) | stdio.c (55837) |
---|---|
1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38#if 0 39static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93"; 40#endif 41static const char rcsid[] = | 1/*- 2 * Copyright (c) 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38#if 0 39static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93"; 40#endif 41static const char rcsid[] = |
42 "$FreeBSD: head/lib/libc/stdio/stdio.c 50476 1999-08-28 00:22:10Z peter $"; | 42 "$FreeBSD: head/lib/libc/stdio/stdio.c 55837 2000-01-12 09:23:48Z jasone $"; |
43#endif /* LIBC_SCCS and not lint */ 44 45#include <fcntl.h> 46#include <unistd.h> 47#include <stdio.h> 48#include "local.h" 49 50/* --- 4 unchanged lines hidden (view full) --- 55__sread(cookie, buf, n) 56 void *cookie; 57 char *buf; 58 int n; 59{ 60 register FILE *fp = cookie; 61 register int ret; 62 | 43#endif /* LIBC_SCCS and not lint */ 44 45#include <fcntl.h> 46#include <unistd.h> 47#include <stdio.h> 48#include "local.h" 49 50/* --- 4 unchanged lines hidden (view full) --- 55__sread(cookie, buf, n) 56 void *cookie; 57 char *buf; 58 int n; 59{ 60 register FILE *fp = cookie; 61 register int ret; 62 |
63 ret = read(fp->_file, buf, (size_t)n); | 63 ret = _libc_read(fp->_file, buf, (size_t)n); |
64 /* if the read succeeded, update the current offset */ 65 if (ret >= 0) 66 fp->_offset += ret; 67 else 68 fp->_flags &= ~__SOFF; /* paranoia */ 69 return (ret); 70} 71 72int 73__swrite(cookie, buf, n) 74 void *cookie; 75 char const *buf; 76 int n; 77{ 78 register FILE *fp = cookie; 79 80 if (fp->_flags & __SAPP) 81 (void) lseek(fp->_file, (off_t)0, SEEK_END); 82 fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */ | 64 /* if the read succeeded, update the current offset */ 65 if (ret >= 0) 66 fp->_offset += ret; 67 else 68 fp->_flags &= ~__SOFF; /* paranoia */ 69 return (ret); 70} 71 72int 73__swrite(cookie, buf, n) 74 void *cookie; 75 char const *buf; 76 int n; 77{ 78 register FILE *fp = cookie; 79 80 if (fp->_flags & __SAPP) 81 (void) lseek(fp->_file, (off_t)0, SEEK_END); 82 fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */ |
83 return (write(fp->_file, buf, (size_t)n)); | 83 return (_libc_write(fp->_file, buf, (size_t)n)); |
84} 85 86fpos_t 87__sseek(cookie, offset, whence) 88 void *cookie; 89 fpos_t offset; 90 int whence; 91{ --- 10 unchanged lines hidden (view full) --- 102 return (ret); 103} 104 105int 106__sclose(cookie) 107 void *cookie; 108{ 109 | 84} 85 86fpos_t 87__sseek(cookie, offset, whence) 88 void *cookie; 89 fpos_t offset; 90 int whence; 91{ --- 10 unchanged lines hidden (view full) --- 102 return (ret); 103} 104 105int 106__sclose(cookie) 107 void *cookie; 108{ 109 |
110 return (close(((FILE *)cookie)->_file)); | 110 return (_libc_close(((FILE *)cookie)->_file)); |
111} | 111} |