Update contrib.
3 * Portions Copyright (c) 1990-2006 Nokia Corporation and/or its subsidiary(-ies).
8 * Copyright (c) 1990 The Regents of the University of California.
11 * Redistribution and use in source and binary forms are permitted
12 * provided that the above copyright notice and this paragraph are
13 * duplicated in all such forms and that any documentation,
14 * advertising materials, and other materials related to such
15 * distribution and use acknowledge that the software was developed
16 * by the University of California, Berkeley. The name of the
17 * University may not be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
26 <<getchar>>---read a character (macro)
37 int _getchar_r(void *<[reent]>);
43 int _getchar_r(<[reent]>)
47 <<getchar>> is a macro, defined in <<stdio.h>>. You can use <<getchar>>
48 to get the next single character from the standard input stream.
49 As a side effect, <<getchar>> advances the standard input's
50 current position indicator.
52 The alternate function <<_getchar_r>> is a reentrant version. The
53 extra argument <[reent]> is a pointer to a reentrancy structure.
57 The next character (read as an <<unsigned char>>, and cast to
58 <<int>>), unless there is no more data, or the host system reports a
59 read error; in either of these situations, <<getchar>> returns <<EOF>>.
61 You can distinguish the two situations that cause an <<EOF>> result by
62 using `<<ferror(stdin)>>' and `<<feof(stdin)>>'.
65 ANSI C requires <<getchar>>; it suggests, but does not require, that
66 <<getchar>> be implemented as a macro.
68 Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
69 <<lseek>>, <<read>>, <<sbrk>>, <<write>>.
73 * A subroutine version of the macro getchar.
82 A reentrant version of getchar().
85 _getchar_r (struct _reent *f)
87 return getc (_stdin_r (f));
93 Get the next character from stdin.Returns the next character from the
96 @return On Success, the character read is returned as an int.
97 On Failure, returns EOF, if the 'End Of File' is reached or there has
98 been an error reading and errno may be set.
103 /* CHECK_INIT is called (eventually) by __srefill. */
104 struct _reent *r = _REENT2;
106 return EOF; // Memory for library globals is not allocated (errno not set).
107 return _getchar_r (r);