Deleted Added
full compact
fseek.c (249808) fseek.c (249810)
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

--- 20 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
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

--- 20 unchanged lines hidden (view full) ---

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/stdio/fseek.c 249808 2013-04-23 13:33:13Z emaste $");
37__FBSDID("$FreeBSD: head/lib/libc/stdio/fseek.c 249810 2013-04-23 14:36:44Z emaste $");
38
39#include "namespace.h"
40#include <sys/types.h>
41#include <sys/stat.h>
42#include <errno.h>
43#include <fcntl.h>
44#include <limits.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include "un-namespace.h"
48#include "local.h"
49#include "libc_private.h"
50
51#define POS_ERR (-(fpos_t)1)
52
53int
38
39#include "namespace.h"
40#include <sys/types.h>
41#include <sys/stat.h>
42#include <errno.h>
43#include <fcntl.h>
44#include <limits.h>
45#include <stdio.h>
46#include <stdlib.h>
47#include "un-namespace.h"
48#include "local.h"
49#include "libc_private.h"
50
51#define POS_ERR (-(fpos_t)1)
52
53int
54fseek(fp, offset, whence)
55 FILE *fp;
56 long offset;
57 int whence;
54fseek(FILE *fp, long offset, int whence)
58{
59 int ret;
60 int serrno = errno;
61
62 /* make sure stdio is set up */
63 if (!__sdidinit)
64 __sinit();
65
66 FLOCKFILE(fp);
67 ret = _fseeko(fp, (off_t)offset, whence, 1);
68 FUNLOCKFILE(fp);
69 if (ret == 0)
70 errno = serrno;
71 return (ret);
72}
73
74int
55{
56 int ret;
57 int serrno = errno;
58
59 /* make sure stdio is set up */
60 if (!__sdidinit)
61 __sinit();
62
63 FLOCKFILE(fp);
64 ret = _fseeko(fp, (off_t)offset, whence, 1);
65 FUNLOCKFILE(fp);
66 if (ret == 0)
67 errno = serrno;
68 return (ret);
69}
70
71int
75fseeko(fp, offset, whence)
76 FILE *fp;
77 off_t offset;
78 int whence;
72fseeko(FILE *fp, off_t offset, int whence)
79{
80 int ret;
81 int serrno = errno;
82
83 /* make sure stdio is set up */
84 if (!__sdidinit)
85 __sinit();
86

--- 5 unchanged lines hidden (view full) ---

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
73{
74 int ret;
75 int serrno = errno;
76
77 /* make sure stdio is set up */
78 if (!__sdidinit)
79 __sinit();
80

--- 5 unchanged lines hidden (view full) ---

86 return (ret);
87}
88
89/*
90 * Seek the given file to the given offset.
91 * `Whence' must be one of the three SEEK_* macros.
92 */
93int
100_fseeko(fp, offset, whence, ltest)
101 FILE *fp;
102 off_t offset;
103 int whence;
104 int ltest;
94_fseeko(FILE *fp, off_t offset, int whence, int ltest)
105{
106 fpos_t (*seekfn)(void *, fpos_t, int);
107 fpos_t target, curoff, ret;
108 size_t n;
109 struct stat st;
110 int havepos;
111
112 /*

--- 199 unchanged lines hidden ---
95{
96 fpos_t (*seekfn)(void *, fpos_t, int);
97 fpos_t target, curoff, ret;
98 size_t n;
99 struct stat st;
100 int havepos;
101
102 /*

--- 199 unchanged lines hidden ---