#!/usr/bin/env ferite

uses "console", "stream", "posix", "sys", "filesystem";

namespace foo
{
    number test;

    function test2()
    {
        Console.println( "real!" );
    }
}

class modifies Stream.Stream
{
    rename readln oldreadln;

    function readln()
    {
        return .oldreadln();
    }
    
    function ConvertStreamToString()
    {
        string str = "";
        
        while( !.eos() )
            str += .readln();
        return str;
    }
}

object anotherfile = File.open( "/etc/fstab" );
Console.println( "------------------------------------------------------" );
Console.println( anotherfile.ConvertStreamToString() );
Console.println( "------------------------------------------------------" );
anotherfile.close();

foo.test2();
