lib/ruby/truffle/pr-zlib/lib/pr/rbzlib.rb
# Reads bytes from the compressed file until len-1 characters are
# read, or a newline character is read and transferred to buf, or an
# end-of-file condition is encountered.  The string is then terminated
# with a null character.
#
# Returns buf, or Z_NULL in case of error.
#
Reads bytes from the compressed file until len-1 characters are
read, or a newline character is read and transferred to buf, or an
end-of-file condition is encountered.  The string is then terminated
with a null character.

Returns buf, or Z_NULL in case of error.
Reads bytes from the compressed file until len - 1 characters are read or a newline character is read and transferred to buf or an end - of - file condition is encountered . The string is then terminated with a null character . Returns buf or Z_NULL in case of error .
def gzgets(file,buf,len)
    return nil if buf.nil? || (len <= 0)
    i = 0
    gzchar = 0.chr
    loop do
      len-=1
      bytes = gzread(file, gzchar, 1)
      buf[i] = gzchar[0]
      i += 1
      break if len == 0 || (bytes != 1) || (gzchar == (13).chr)
    end
    buf[i..-1] = ''
    buf.chomp!(0.chr)
    if i == 0 && (len > 0)
      return nil
    else
      return buf
    end
  end
def gzgets ( file , buf , len ) return nil if buf . nil? || ( len <= 0 ) i = 0 gzchar = 0 . chr loop do len -= 1 bytes = gzread ( file , gzchar , 1 ) buf [ i ] = gzchar [ 0 ] i += 1 break if len == 0 || ( bytes != 1 ) || ( gzchar == ( 13 ) . chr ) end buf [ i .. - 1 ] = '' buf . chomp! ( 0 . chr ) if i == 0 && ( len > 0 ) return nil else return buf end end
Reads bytes from the compressed file until len-1 characters are
read, or a newline character is read and transferred to buf, or an
end-of-file condition is encountered.
Reads bytes from the compressed file until len - 1 characters are read or a newline character is read and transferred to buf or an end - of - file condition is encountered .
file
<not_specific>
buf
<not_specific>
len
<not_specific>