genericopenlibs/cstdlib/LSTDIO/RGET.C
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /* RGET.C
       
     2  * 
       
     3  * Portions Copyright (c) 1990-1999 Nokia Corporation and/or its subsidiary(-ies).
       
     4  * All rights reserved.
       
     5  */
       
     6 
       
     7 /* No user fns here. Pesch 15apr92. */
       
     8 
       
     9 /*
       
    10  * Copyright (c) 1990 The Regents of the University of California.
       
    11  * All rights reserved.
       
    12  *
       
    13  * Redistribution and use in source and binary forms are permitted
       
    14  * provided that the above copyright notice and this paragraph are
       
    15  * duplicated in all such forms and that any documentation,
       
    16  * advertising materials, and other materials related to such
       
    17  * distribution and use acknowledge that the software was developed
       
    18  * by the University of California, Berkeley.  The name of the
       
    19  * University may not be used to endorse or promote products derived
       
    20  * from this software without specific prior written permission.
       
    21  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
       
    22  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
       
    23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
       
    24  */
       
    25 
       
    26 #include <stdio.h>
       
    27 #include "LOCAL.H"
       
    28 
       
    29 /*
       
    30  * Handle getc() when the buffer ran out:
       
    31  * Refill, then return the first character
       
    32  * in the newly-filled buffer.
       
    33  */
       
    34 
       
    35 int
       
    36 __srget (register FILE *fp)
       
    37 {
       
    38   if (__srefill (fp) == 0)
       
    39     {
       
    40       fp->_r--;
       
    41       return *fp->_p++;
       
    42     }
       
    43   return EOF;
       
    44 }