1 /* gnomevfs-copy.c - Test for open(), read() and write() for gnome-vfs
3 Copyright (C) 2003, Red Hat
5 The Gnome Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The Gnome Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the Gnome Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
20 Author: Bastien Nocera <hadess@hadess.net>
23 #include <libgnomevfs/gnome-vfs.h>
29 /* Copied directly from eel */
31 copy_uri_simple ( const char *source_uri, const char *dest_uri)
33 GnomeVFSResult result;
34 GnomeVFSURI *real_source_uri, *real_dest_uri;
35 real_source_uri = gnome_vfs_uri_new (source_uri);
36 real_dest_uri = gnome_vfs_uri_new (dest_uri);
38 result = gnome_vfs_xfer_uri (real_source_uri, real_dest_uri,
39 GNOME_VFS_XFER_RECURSIVE,
40 GNOME_VFS_XFER_ERROR_MODE_ABORT,
41 GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE,
44 gnome_vfs_uri_unref (real_source_uri);
45 gnome_vfs_uri_unref (real_dest_uri);
51 main (int argc, char **argv)
56 printf ("Usage: %s <src> <dest>\n", argv[0]);
60 if (!gnome_vfs_init ()) {
61 fprintf (stderr, "Cannot initialize gnome-vfs.\n");
65 res = copy_uri_simple (argv[1], argv[2]);
67 if (res != GNOME_VFS_OK) {
68 fprintf (stderr, "Failed to copy %s to %s\nReason: %s\n",
69 argv[1], argv[2], gnome_vfs_result_to_string (res));