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 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; |
66 int serrno = errno; |
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; |
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; |
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; |
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 --- |