source: trunk/libs/newlib/src/newlib/libc/stdio/putchar_u.c @ 450

Last change on this file since 450 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.3 KB
Line 
1/*
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley.  The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17
18/*
19FUNCTION
20<<putchar_unlocked>>---non-thread-safe version of putchar (macro)
21
22INDEX
23        putchar_unlocked
24
25SYNOPSIS
26        #include <stdio.h>
27        int putchar_unlocked(int <[ch]>);
28
29DESCRIPTION
30<<putchar_unlocked>> is a non-thread-safe version of <<putchar>>
31declared in <<stdio.h>>.  <<putchar_unlocked>> may only safely be used
32within a scope protected by flockfile() (or ftrylockfile()) and
33funlockfile().  These functions may safely be used in a multi-threaded
34program if and only if they are called while the invoking thread owns
35the ( FILE *) object, as is the case after a successful call to the
36flockfile() or ftrylockfile() functions.  If threads are disabled,
37then <<putchar_unlocked>> is equivalent to <<putchar>>.
38
39RETURNS
40See <<putchar>>.
41
42PORTABILITY
43POSIX 1003.1 requires <<putchar_unlocked>>.  <<putchar_unlocked>> may
44be implemented as a macro.
45
46Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
47<<lseek>>, <<read>>, <<sbrk>>, <<write>>.  */
48
49#if defined(LIBC_SCCS) && !defined(lint)
50static char sccsid[] = "%W% (Berkeley) %G%";
51#endif /* LIBC_SCCS and not lint */
52
53/*
54 * A subroutine version of the macro putchar_unlocked.
55 */
56
57#include <_ansi.h>
58#include <reent.h>
59#include <stdio.h>
60
61#undef putchar_unlocked
62
63int
64_putchar_unlocked_r (struct _reent *ptr,
65       int c)
66{
67  return putc_unlocked (c, _stdout_r (ptr));
68}
69
70#ifndef _REENT_ONLY
71
72int
73putchar_unlocked (int c)
74{
75  /* CHECK_INIT is (eventually) called by __swbuf.  */
76
77  return _putchar_unlocked_r (_REENT, c);
78}
79
80#endif
Note: See TracBrowser for help on using the repository browser.