ungetc.c (92986) | ungetc.c (101776) |
---|---|
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 --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)ungetc.c 8.2 (Berkeley) 11/3/93"; 39#endif /* LIBC_SCCS and not lint */ 40#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 --- 24 unchanged lines hidden (view full) --- 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)ungetc.c 8.2 (Berkeley) 11/3/93"; 39#endif /* LIBC_SCCS and not lint */ 40#include <sys/cdefs.h> |
41__FBSDID("$FreeBSD: head/lib/libc/stdio/ungetc.c 92986 2002-03-22 21:53:29Z obrien $"); | 41__FBSDID("$FreeBSD: head/lib/libc/stdio/ungetc.c 101776 2002-08-13 09:30:41Z tjr $"); |
42 43#include "namespace.h" 44#include <stdio.h> 45#include <stdlib.h> 46#include <string.h> 47#include "un-namespace.h" 48#include "local.h" 49#include "libc_private.h" --- 57 unchanged lines hidden (view full) --- 107} 108 109/* 110 * Non-MT-safe version 111 */ 112int 113__ungetc(int c, FILE *fp) 114{ | 42 43#include "namespace.h" 44#include <stdio.h> 45#include <stdlib.h> 46#include <string.h> 47#include "un-namespace.h" 48#include "local.h" 49#include "libc_private.h" --- 57 unchanged lines hidden (view full) --- 107} 108 109/* 110 * Non-MT-safe version 111 */ 112int 113__ungetc(int c, FILE *fp) 114{ |
115 116 ORIENT(fp, -1); 117 |
|
115 if (c == EOF) 116 return (EOF); 117 if ((fp->_flags & __SRD) == 0) { 118 /* 119 * Not already reading: no good unless reading-and-writing. 120 * Otherwise, flush any current write stuff. 121 */ 122 if ((fp->_flags & __SRW) == 0) --- 50 unchanged lines hidden --- | 118 if (c == EOF) 119 return (EOF); 120 if ((fp->_flags & __SRD) == 0) { 121 /* 122 * Not already reading: no good unless reading-and-writing. 123 * Otherwise, flush any current write stuff. 124 */ 125 if ((fp->_flags & __SRW) == 0) --- 50 unchanged lines hidden --- |