os/ossrv/genericopenlibs/cstdlib/LSTDIO/RGET.C
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LSTDIO/RGET.C	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* RGET.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 +/* No user fns here. Pesch 15apr92. */
    1.11 +
    1.12 +/*
    1.13 + * Copyright (c) 1990 The Regents of the University of California.
    1.14 + * All rights reserved.
    1.15 + *
    1.16 + * Redistribution and use in source and binary forms are permitted
    1.17 + * provided that the above copyright notice and this paragraph are
    1.18 + * duplicated in all such forms and that any documentation,
    1.19 + * advertising materials, and other materials related to such
    1.20 + * distribution and use acknowledge that the software was developed
    1.21 + * by the University of California, Berkeley.  The name of the
    1.22 + * University may not be used to endorse or promote products derived
    1.23 + * from this software without specific prior written permission.
    1.24 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
    1.25 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
    1.26 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    1.27 + */
    1.28 +
    1.29 +#include <stdio.h>
    1.30 +#include "LOCAL.H"
    1.31 +
    1.32 +/*
    1.33 + * Handle getc() when the buffer ran out:
    1.34 + * Refill, then return the first character
    1.35 + * in the newly-filled buffer.
    1.36 + */
    1.37 +
    1.38 +int
    1.39 +__srget (register FILE *fp)
    1.40 +{
    1.41 +  if (__srefill (fp) == 0)
    1.42 +    {
    1.43 +      fp->_r--;
    1.44 +      return *fp->_p++;
    1.45 +    }
    1.46 +  return EOF;
    1.47 +}