OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [stdio/] [getchar.c] - Diff between revs 148 and 158

Only display areas with differences | Details | Blame | View Log

Rev 148 Rev 158
/*
/*
 * Copyright (c) 1990 The Regents of the University of California.
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
 * All rights reserved.
 *
 *
 * Redistribution and use in source and binary forms are permitted
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * distribution and use acknowledge that the software was developed
 * by the University of California, Berkeley.  The name of the
 * by the University of California, Berkeley.  The name of the
 * University may not be used to endorse or promote products derived
 * University may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 * from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */
 */
 
 
/*
/*
FUNCTION
FUNCTION
<<getchar>>---read a character (macro)
<<getchar>>---read a character (macro)
 
 
INDEX
INDEX
        getchar
        getchar
INDEX
INDEX
        _getchar_r
        _getchar_r
 
 
ANSI_SYNOPSIS
ANSI_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        int getchar(void);
        int getchar(void);
 
 
        int _getchar_r(struct _reent *<[reent]>);
        int _getchar_r(struct _reent *<[reent]>);
 
 
TRAD_SYNOPSIS
TRAD_SYNOPSIS
        #include <stdio.h>
        #include <stdio.h>
        int getchar();
        int getchar();
 
 
        int _getchar_r(<[reent]>)
        int _getchar_r(<[reent]>)
        char * <[reent]>;
        char * <[reent]>;
 
 
DESCRIPTION
DESCRIPTION
<<getchar>> is a macro, defined in <<stdio.h>>.  You can use <<getchar>>
<<getchar>> is a macro, defined in <<stdio.h>>.  You can use <<getchar>>
to get the next single character from the standard input stream.
to get the next single character from the standard input stream.
As a side effect, <<getchar>> advances the standard input's
As a side effect, <<getchar>> advances the standard input's
current position indicator.
current position indicator.
 
 
The alternate function <<_getchar_r>> is a reentrant version.  The
The alternate function <<_getchar_r>> is a reentrant version.  The
extra argument <[reent]> is a pointer to a reentrancy structure.
extra argument <[reent]> is a pointer to a reentrancy structure.
 
 
 
 
RETURNS
RETURNS
The next character (read as an <<unsigned char>>, and cast to
The next character (read as an <<unsigned char>>, and cast to
<<int>>), unless there is no more data, or the host system reports a
<<int>>), unless there is no more data, or the host system reports a
read error; in either of these situations, <<getchar>> returns <<EOF>>.
read error; in either of these situations, <<getchar>> returns <<EOF>>.
 
 
You can distinguish the two situations that cause an <<EOF>> result by
You can distinguish the two situations that cause an <<EOF>> result by
using `<<ferror(stdin)>>' and `<<feof(stdin)>>'.
using `<<ferror(stdin)>>' and `<<feof(stdin)>>'.
 
 
PORTABILITY
PORTABILITY
ANSI C requires <<getchar>>; it suggests, but does not require, that
ANSI C requires <<getchar>>; it suggests, but does not require, that
<<getchar>> be implemented as a macro.
<<getchar>> be implemented as a macro.
 
 
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
*/
*/
 
 
#if defined(LIBC_SCCS) && !defined(lint)
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#endif /* LIBC_SCCS and not lint */
 
 
/*
/*
 * A subroutine version of the macro getchar.
 * A subroutine version of the macro getchar.
 */
 */
 
 
#include <_ansi.h>
#include <_ansi.h>
#include <reent.h>
#include <reent.h>
#include <stdio.h>
#include <stdio.h>
#include "local.h"
#include "local.h"
 
 
#undef getchar
#undef getchar
 
 
int
int
_DEFUN(_getchar_r, (reent),
_DEFUN(_getchar_r, (reent),
       struct _reent *reent)
       struct _reent *reent)
{
{
  _REENT_SMALL_CHECK_INIT (reent);
  _REENT_SMALL_CHECK_INIT (reent);
  return _getc_r (reent, _stdin_r (reent));
  return _getc_r (reent, _stdin_r (reent));
}
}
 
 
#ifndef _REENT_ONLY
#ifndef _REENT_ONLY
 
 
int
int
_DEFUN_VOID(getchar)
_DEFUN_VOID(getchar)
{
{
  /* CHECK_INIT is called (eventually) by __srefill_r.  */
  /* CHECK_INIT is called (eventually) by __srefill_r.  */
  _REENT_SMALL_CHECK_INIT (_REENT);
  _REENT_SMALL_CHECK_INIT (_REENT);
  return _getc_r (_REENT, _stdin_r (_REENT));
  return _getc_r (_REENT, _stdin_r (_REENT));
}
}
 
 
#endif
#endif
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.