/* gcc `pkg-config --libs --cflags gtk+-2.0 gnome-vfs-2.0` test-smb.c -o test-smb */ #include #include int main (int argc, const char **argv) { GList *list; GList *node; GnomeVFSResult result; GnomeVFSFileInfo *info; /*const gchar *uri = "smb://darthvader";*/ const gchar *head = "smb://128.113.144."; gchar *uri; gint i = 1; /* initialize gnome-vfs */ gnome_vfs_init (); /* Build the IP addresses */ for (i=0;i<255;i++) { uri = g_strdup_printf ("%s%d", head, i); printf ("%s\n", uri); result = gnome_vfs_directory_list_load (&list, uri, GNOME_VFS_FILE_INFO_DEFAULT); if (result == GNOME_VFS_OK) { for (node = list; node != NULL; node = node->next) { info = node->data; printf ("%s\n", info->name); } } else { printf ("%s\n", "Gnome VFS Error"); } g_free (uri); } return 0; }