5 FGetsLenAsync( _REG( a0
) AsyncFile
*file
, _REG( a1
) APTR buf
,
6 _REG( d0
) LONG numBytes
, _REG( a2
) LONG
*len
)
13 /* Make room for \n and \0 */
16 /* Handle senseless cases */
25 ptr
= ( UBYTE
* ) file
->af_Offset
;
27 if( count
= file
->af_BytesLeft
)
29 count
= MIN( count
, numBytes
);
31 for( i
= 0; ( i
< count
) && ( *ptr
!= '\n' ); ++i
)
38 /* Check for valid EOL char */
41 /* MH: Since i < count, and count <= numBytes,
42 * there _is_ room for \n\0.
44 *p
++ = '\n'; /* "Read" EOL char */
49 file
->af_BytesLeft
-= i
;
52 if( ( i
>= numBytes
) || ( *( p
- 1 ) == '\n' ) )
54 /* MH: It is enough to break out of the loop.
55 * no need to "waste" code by making a special
64 /* MH: numBytes must be at least 1 here, so there is still room
65 * for \n\0, in case we read \n.
68 if( ReadAsync( file
, p
, 1 ) < 1 )
85 if( p
== ( UBYTE
* ) buf
)
95 FGetsAsync( _REG( a0
) AsyncFile
*file
, _REG( a1
) APTR buf
, _REG( d0
) LONG numBytes
)
99 return( FGetsLenAsync( file
, buf
, numBytes
, &len
) );