putc.c revision 330897
111820Sjulian/*- 211820Sjulian * SPDX-License-Identifier: BSD-3-Clause 311820Sjulian * 411820Sjulian * Copyright (c) 1990, 1993 511820Sjulian * The Regents of the University of California. All rights reserved. 611820Sjulian * 711820Sjulian * This code is derived from software contributed to Berkeley by 811820Sjulian * Chris Torek. 911820Sjulian * 1011820Sjulian * Redistribution and use in source and binary forms, with or without 1111820Sjulian * modification, are permitted provided that the following conditions 1211820Sjulian * are met: 1311820Sjulian * 1. Redistributions of source code must retain the above copyright 1411820Sjulian * notice, this list of conditions and the following disclaimer. 1511820Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1611820Sjulian * notice, this list of conditions and the following disclaimer in the 1711820Sjulian * documentation and/or other materials provided with the distribution. 1811820Sjulian * 3. Neither the name of the University nor the names of its contributors 1911820Sjulian * may be used to endorse or promote products derived from this software 2011820Sjulian * without specific prior written permission. 2111820Sjulian * 2211820Sjulian * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2311820Sjulian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2411820Sjulian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2511820Sjulian * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2611820Sjulian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2711820Sjulian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2811820Sjulian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2911820Sjulian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3011820Sjulian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3111820Sjulian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3211820Sjulian * SUCH DAMAGE. 3311820Sjulian */ 3411820Sjulian 3511820Sjulian#if defined(LIBC_SCCS) && !defined(lint) 3611820Sjulianstatic char sccsid[] = "@(#)putc.c 8.1 (Berkeley) 6/4/93"; 3727244Sjhay#endif /* LIBC_SCCS and not lint */ 3811820Sjulian#include <sys/cdefs.h> 3911820Sjulian__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/putc.c 330897 2018-03-14 03:19:51Z eadler $"); 4011820Sjulian 4111820Sjulian#include "namespace.h" 4211820Sjulian#include <stdio.h> 4311820Sjulian#include "un-namespace.h" 4411820Sjulian#include "local.h" 4511820Sjulian#include "libc_private.h" 4611820Sjulian 4711820Sjulian#undef putc 4811820Sjulian#undef putc_unlocked 4911820Sjulian 5011820Sjulianint 5111820Sjulianputc(int c, FILE *fp) 5211820Sjulian{ 5311820Sjulian int retval; 5411820Sjulian FLOCKFILE_CANCELSAFE(fp); 5511820Sjulian /* Orientation set by __sputc() when buffer is full. */ 5611820Sjulian /* ORIENT(fp, -1); */ 5711820Sjulian retval = __sputc(c, fp); 5811820Sjulian FUNLOCKFILE_CANCELSAFE(); 5911820Sjulian return (retval); 6011820Sjulian} 6111820Sjulian 6211820Sjulianint 6311820Sjulianputc_unlocked(int ch, FILE *fp) 6411820Sjulian{ 6511820Sjulian 6611820Sjulian return (__sputc(ch, fp)); 6711820Sjulian} 6811820Sjulian