using GLib;

public static void main(string[] args)
{
    File basedir = File.new_for_path ("/usr");
    string attrs = "%s,%s,%s".printf (FILE_ATTRIBUTE_STANDARD_TYPE,
        FILE_ATTRIBUTE_ACCESS_CAN_READ, FILE_ATTRIBUTE_STANDARD_NAME);

	FileEnumerator files;
    try {
        files = basedir.enumerate_children (
            attrs, 0, null);
    } catch (Error e) {
        critical ("Could not read directory: %s", e.message);
        return;
    }
    
    try {
        FileInfo childinfo;
        while ((childinfo = files.next_file (null)) != null)
        {
            stdout.printf ("%s", childinfo.get_name ());
        }
    } catch (Error e) {
        critical ("%s", e.message);
    } finally {
        try {
            files.close (null);
        } catch (Error e) {
            critical ("Could not close file: %s", e.message);
        }
    }

}
