- while ( ( *dest = stdin->buffer[stdin->bufidx++] ) != '\n' )
- {
- ++dest;
- if ( stdin->bufidx == stdin->bufend )
- {
- if ( _PDCLIB_fillbuffer( stdin ) == EOF )
- {
- break;
- }
- }
+
+ dest += _PDCLIB_getchars( dest, SIZE_MAX, '\n', stdin );
+ _PDCLIB_funlockfile( stdin );
+
+ if(*(dest - 1) == '\n') {
+ *(--dest) = '\0';
+ } else {
+ *dest = '\0';