os/ossrv/genericopenlibs/cstdlib/LSTDIO/GETC.C
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LSTDIO/GETC.C	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,91 @@
     1.4 +/* GETC.C
     1.5 + * 
     1.6 + * Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies).
     1.7 + * All rights reserved.
     1.8 + */
     1.9 +
    1.10 +/*
    1.11 + * Copyright (c) 1990 The Regents of the University of California.
    1.12 + * All rights reserved.
    1.13 + *
    1.14 + * Redistribution and use in source and binary forms are permitted
    1.15 + * provided that the above copyright notice and this paragraph are
    1.16 + * duplicated in all such forms and that any documentation,
    1.17 + * advertising materials, and other materials related to such
    1.18 + * distribution and use acknowledge that the software was developed
    1.19 + * by the University of California, Berkeley.  The name of the
    1.20 + * University may not be used to endorse or promote products derived
    1.21 + * from this software without specific prior written permission.
    1.22 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
    1.23 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
    1.24 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    1.25 + */
    1.26 +
    1.27 +/*
    1.28 +FUNCTION
    1.29 +<<getc>>---read a character (macro)
    1.30 +
    1.31 +INDEX
    1.32 +	getc
    1.33 +
    1.34 +ANSI_SYNOPSIS
    1.35 +	#include <stdio.h>
    1.36 +	int getc(FILE *<[fp]>);
    1.37 +
    1.38 +TRAD_SYNOPSIS
    1.39 +	#include <stdio.h>
    1.40 +	int getc(<[fp]>)
    1.41 +	FILE *<[fp]>;
    1.42 +
    1.43 +DESCRIPTION
    1.44 +<<getc>> is a macro, defined in <<stdio.h>>.  You can use <<getc>>
    1.45 +to get the next single character from the file or stream
    1.46 +identified by <[fp]>.  As a side effect, <<getc>> advances the file's
    1.47 +current position indicator.
    1.48 +
    1.49 +For a subroutine version of this macro, see <<fgetc>>.
    1.50 +
    1.51 +RETURNS
    1.52 +The next character (read as an <<unsigned char>>, and cast to
    1.53 +<<int>>), unless there is no more data, or the host system reports a
    1.54 +read error; in either of these situations, <<getc>> returns <<EOF>>.
    1.55 +
    1.56 +You can distinguish the two situations that cause an <<EOF>> result by
    1.57 +using the <<ferror>> and <<feof>> functions.
    1.58 +
    1.59 +PORTABILITY
    1.60 +ANSI C requires <<getc>>; it suggests, but does not require, that
    1.61 +<<getc>> be implemented as a macro.  The standard explicitly permits
    1.62 +macro implementations of <<getc>> to use the argument more than once;
    1.63 +therefore, in a portable program, you should not use an expression
    1.64 +with side effects as the <<getc>> argument.
    1.65 +
    1.66 +Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
    1.67 +<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
    1.68 +*/
    1.69 +
    1.70 +#include <stdio.h>
    1.71 +#include "LOCAL.H"
    1.72 +
    1.73 +/*
    1.74 + * A subroutine version of the macro getc.
    1.75 + */
    1.76 +
    1.77 +#undef getc
    1.78 +
    1.79 +/**
    1.80 +Get the next character.
    1.81 +Returns the next character of the stream and increases the file pointer
    1.82 +to point to the next character.
    1.83 +@return The character read is returned as an int value.
    1.84 +If the End Of File has been reached or there has been an error reading, 
    1.85 +the function returns EOF.
    1.86 +@param fp pointer to an open file.
    1.87 +*/
    1.88 +EXPORT_C int
    1.89 +getc (register FILE *fp)
    1.90 +{
    1.91 +  /* CHECK_INIT is called (eventually) by __srefill.  */
    1.92 +
    1.93 +  return __sgetc (fp);
    1.94 +}