X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=fish%2Fcopy.c;h=f5edad116943fbc47677d57a1fba5340cfd93d15;hp=944f4ccb7c87955491f34e160b52f3a6f62c4e1e;hb=74f7c9e4b7e27787e2052166eeedfbac5814200b;hpb=878c8c77d8b46b1c4dd5189f67f0262d44eed70c diff --git a/fish/copy.c b/fish/copy.c index 944f4cc..f5edad1 100644 --- a/fish/copy.c +++ b/fish/copy.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -31,10 +30,10 @@ static int make_tar_from_local (const char *local); static int make_tar_output (const char *local, const char *basename); -static int split_path (char *buf, size_t buf_size, const char *path, char **dirname, char **basename); +static int split_path (char *buf, size_t buf_size, const char *path, const char **dirname, const char **basename); int -do_copy_in (const char *cmd, int argc, char *argv[]) +run_copy_in (const char *cmd, size_t argc, char *argv[]) { if (argc < 2) { fprintf (stderr, @@ -119,7 +118,7 @@ make_tar_from_local (const char *local) close (fd[1]); char buf[PATH_MAX]; - char *dirname, *basename; + const char *dirname, *basename; if (split_path (buf, sizeof buf, local, &dirname, &basename) == -1) _exit (EXIT_FAILURE); @@ -132,7 +131,7 @@ make_tar_from_local (const char *local) */ static int split_path (char *buf, size_t buf_size, - const char *path, char **dirname, char **basename) + const char *path, const char **dirname, const char **basename) { size_t len = strlen (path); if (len == 0 || len > buf_size - 1) { @@ -154,7 +153,7 @@ split_path (char *buf, size_t buf_size, if (dirname) *dirname = buf; if (basename) *basename = p; } else if (p && p == buf) { /* "/foo" */ - if (dirname) *dirname = bad_cast ("/"); + if (dirname) *dirname = "/"; if (basename) *basename = buf+1; } else { if (dirname) *dirname = NULL; @@ -177,7 +176,7 @@ tar_create (const char *dir, const char *path) } int -do_copy_out (const char *cmd, int argc, char *argv[]) +run_copy_out (const char *cmd, size_t argc, char *argv[]) { if (argc < 2) { fprintf (stderr, @@ -207,7 +206,7 @@ do_copy_out (const char *cmd, int argc, char *argv[]) return -1; if (r == 1) { /* is file */ char buf[PATH_MAX]; - char *basename; + const char *basename; if (split_path (buf, sizeof buf, argv[i], NULL, &basename) == -1) return -1; @@ -228,7 +227,7 @@ do_copy_out (const char *cmd, int argc, char *argv[]) } char buf[PATH_MAX]; - char *basename; + const char *basename; if (split_path (buf, sizeof buf, argv[i], NULL, &basename) == -1) return -1;