freopen.c (333fc21e3cd79bca0c94d7722c5a56cb5ad078d1) freopen.c (54e4e385de33a961e801ceeea8146437e25edd88)
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

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

54
55/*
56 * Re-direct an existing, open (probably) file to some other file.
57 * ANSI is written such that the original file gets closed if at
58 * all possible, no matter what.
59 */
60FILE *
61freopen(file, mode, fp)
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

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

54
55/*
56 * Re-direct an existing, open (probably) file to some other file.
57 * ANSI is written such that the original file gets closed if at
58 * all possible, no matter what.
59 */
60FILE *
61freopen(file, mode, fp)
62 const char *file, *mode;
62 const char * __restrict file;
63 const char * __restrict mode;
63 FILE *fp;
64{
65 int f;
66 int flags, isopen, oflags, sverrno, wantfd;
67
68 if ((flags = __sflags(mode, &oflags)) == 0) {
69 (void) fclose(fp);
70 return (NULL);

--- 94 unchanged lines hidden ---
64 FILE *fp;
65{
66 int f;
67 int flags, isopen, oflags, sverrno, wantfd;
68
69 if ((flags = __sflags(mode, &oflags)) == 0) {
70 (void) fclose(fp);
71 return (NULL);

--- 94 unchanged lines hidden ---