freopen.c (249808) | freopen.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[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93"; 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[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93"; 35#endif /* LIBC_SCCS and not lint */ 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/lib/libc/stdio/freopen.c 249808 2013-04-23 13:33:13Z emaste $"); | 37__FBSDID("$FreeBSD: head/lib/libc/stdio/freopen.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 <fcntl.h> 43#include <errno.h> 44#include <limits.h> 45#include <unistd.h> --- 4 unchanged lines hidden (view full) --- 50#include "local.h" 51 52/* 53 * Re-direct an existing, open (probably) file to some other file. 54 * ANSI is written such that the original file gets closed if at 55 * all possible, no matter what. 56 */ 57FILE * | 38 39#include "namespace.h" 40#include <sys/types.h> 41#include <sys/stat.h> 42#include <fcntl.h> 43#include <errno.h> 44#include <limits.h> 45#include <unistd.h> --- 4 unchanged lines hidden (view full) --- 50#include "local.h" 51 52/* 53 * Re-direct an existing, open (probably) file to some other file. 54 * ANSI is written such that the original file gets closed if at 55 * all possible, no matter what. 56 */ 57FILE * |
58freopen(file, mode, fp) 59 const char * __restrict file; 60 const char * __restrict mode; 61 FILE *fp; | 58freopen(const char * __restrict file, const char * __restrict mode, 59 FILE * __restrict fp) |
62{ 63 int f; 64 int dflags, flags, isopen, oflags, sverrno, wantfd; 65 66 if ((flags = __sflags(mode, &oflags)) == 0) { 67 sverrno = errno; 68 (void) fclose(fp); 69 errno = sverrno; --- 171 unchanged lines hidden --- | 60{ 61 int f; 62 int dflags, flags, isopen, oflags, sverrno, wantfd; 63 64 if ((flags = __sflags(mode, &oflags)) == 0) { 65 sverrno = errno; 66 (void) fclose(fp); 67 errno = sverrno; --- 171 unchanged lines hidden --- |