renatofilho@645: #include <stdlib.h>
renatofilho@645: #include <string.h>
renatofilho@645: #include <libgnomevfs/gnome-vfs.h>
renatofilho@644: #include <glib.h>
renatofilho@644: 
renatofilho@644: static void 
renatofilho@644: assert_message (gboolean valid, const gchar* message)
renatofilho@644: {
renatofilho@644:     if (!valid) {
renatofilho@644:         g_warning (message);            
renatofilho@644:         exit (1);
renatofilho@644:     }
renatofilho@644: }
renatofilho@644:         
renatofilho@644: int main (int argc, char** argv)
renatofilho@644: {
renatofilho@644:         GnomeVFSResult result;
renatofilho@644:         GnomeVFSFileSize read;
renatofilho@644:         gchar buff[512];
renatofilho@645:         GnomeVFSHandle *handle = NULL;
renatofilho@644:         
renatofilho@644:        
renatofilho@644:         g_assert (argc == 2);
renatofilho@644:         
renatofilho@644:         gnome_vfs_init ();
renatofilho@644: 
renatofilho@644:         g_debug ("Oppening: %s", argv[1]);
renatofilho@644: 
renatofilho@644:         result = gnome_vfs_open (&handle, argv[1], GNOME_VFS_OPEN_READ);
renatofilho@644:         assert_message (result == GNOME_VFS_OK, 
renatofilho@644:                         gnome_vfs_result_to_string (result));
renatofilho@644: 
renatofilho@645: 		g_debug ("handle %p", handle);
renatofilho@645: 
renatofilho@644:         while (result == GNOME_VFS_OK) {
renatofilho@644:             memset (buff, '\0', sizeof (buff));
renatofilho@644:             result = gnome_vfs_read (handle, buff, sizeof (buff), &read);
renatofilho@645: 			g_debug ("read %"G_GINT64_FORMAT, read);
renatofilho@644:         }
renatofilho@644: 
renatofilho@644:         assert_message (result == GNOME_VFS_ERROR_EOF, 
renatofilho@644:                         gnome_vfs_result_to_string (result));
renatofilho@644: 
renatofilho@644:         result = gnome_vfs_close (handle);
renatofilho@644:         assert_message (result == GNOME_VFS_OK, 
renatofilho@644:                         gnome_vfs_result_to_string (result));
renatofilho@644: 
renatofilho@644:         g_debug ("OK");
renatofilho@644:         return 0;
renatofilho@644: }