+static inline _PDCLIB_size_t _PDCLIB_getchars( char * out, _PDCLIB_size_t n,\r
+ int stopchar,\r
+ struct _PDCLIB_file_t * stream )\r
+{\r
+ _PDCLIB_size_t i = 0;\r
+ int c;\r
+ while ( stream->ungetidx > 0 && i != n )\r
+ {\r
+ c = (unsigned char) \r
+ ( out[ i++ ] = stream->ungetbuf[ --(stream->ungetidx) ] );\r
+ if( c == stopchar )\r
+ return i;\r
+ }\r
+\r
+ while ( i != n )\r
+ {\r
+ while ( stream->bufidx != stream->bufend && i != n) \r
+ {\r
+ c = (unsigned char) \r
+ ( out[ i++ ] = stream->buffer[ stream->bufidx++ ] );\r
+ if( c == stopchar )\r
+ return i;\r
+ }\r
+\r
+ if ( stream->bufidx == stream->bufend )\r
+ {\r
+ if( _PDCLIB_fillbuffer( stream ) == -1 )\r
+ {\r
+ return i;\r
+ }\r
+ }\r
+ }\r
+\r
+ return i;\r
+}\r