fseek.c (82742) | fseek.c (82743) |
---|---|
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[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94"; 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[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94"; 40#endif 41static const char rcsid[] = |
42 "$FreeBSD: head/lib/libc/stdio/fseek.c 82742 2001-09-01 15:01:37Z ache $"; | 42 "$FreeBSD: head/lib/libc/stdio/fseek.c 82743 2001-09-01 15:28:24Z ache $"; |
43#endif /* LIBC_SCCS and not lint */ 44 45#include "namespace.h" 46#include <sys/types.h> 47#include <sys/stat.h> 48#include <errno.h> 49#include <fcntl.h> 50#include <limits.h> --- 7 unchanged lines hidden (view full) --- 58 59int 60fseek(fp, offset, whence) 61 register FILE *fp; 62 long offset; 63 int whence; 64{ 65 int ret; | 43#endif /* LIBC_SCCS and not lint */ 44 45#include "namespace.h" 46#include <sys/types.h> 47#include <sys/stat.h> 48#include <errno.h> 49#include <fcntl.h> 50#include <limits.h> --- 7 unchanged lines hidden (view full) --- 58 59int 60fseek(fp, offset, whence) 61 register FILE *fp; 62 long offset; 63 int whence; 64{ 65 int ret; |
66 int serrno = errno; |
|
66 67 /* make sure stdio is set up */ 68 if (!__sdidinit) 69 __sinit(); 70 71 FLOCKFILE(fp); 72 ret = _fseeko(fp, (off_t)offset, whence, 1); 73 FUNLOCKFILE(fp); | 67 68 /* make sure stdio is set up */ 69 if (!__sdidinit) 70 __sinit(); 71 72 FLOCKFILE(fp); 73 ret = _fseeko(fp, (off_t)offset, whence, 1); 74 FUNLOCKFILE(fp); |
75 if (ret == 0) 76 errno = serrno; |
|
74 return (ret); 75} 76 77int 78fseeko(fp, offset, whence) 79 FILE *fp; 80 off_t offset; 81 int whence; 82{ 83 int ret; | 77 return (ret); 78} 79 80int 81fseeko(fp, offset, whence) 82 FILE *fp; 83 off_t offset; 84 int whence; 85{ 86 int ret; |
87 int serrno = errno; |
|
84 85 /* make sure stdio is set up */ 86 if (!__sdidinit) 87 __sinit(); 88 89 FLOCKFILE(fp); 90 ret = _fseeko(fp, offset, whence, 0); 91 FUNLOCKFILE(fp); | 88 89 /* make sure stdio is set up */ 90 if (!__sdidinit) 91 __sinit(); 92 93 FLOCKFILE(fp); 94 ret = _fseeko(fp, offset, whence, 0); 95 FUNLOCKFILE(fp); |
96 if (ret == 0) 97 errno = serrno; |
|
92 return (ret); 93} 94 95/* 96 * Seek the given file to the given offset. 97 * `Whence' must be one of the three SEEK_* macros. 98 */ 99int --- 209 unchanged lines hidden --- | 98 return (ret); 99} 100 101/* 102 * Seek the given file to the given offset. 103 * `Whence' must be one of the three SEEK_* macros. 104 */ 105int --- 209 unchanged lines hidden --- |