Re: [Libguestfs] [PATCH] cat: add -m option

Richard W.M. Jones
2014-06-23T11:29:07Z

On Mon, Jun 23, 2014 at 01:00:11PM +0200, Pino Toscano
wrote:
>  static int
> +do_cat_simple (int argc, char *argv[])
> +{
> +  unsigned errors = 0;
> +  int i;
> +
> +  for (i = 0; i < argc; ++i) {
> +    if (guestfs_download (g, argv[i], "/dev/stdout") == -1)
> +      errors++;
> +  }
> +
> +  return errors == 0 ? 0 : -1;
> +}

The problem with this function is two-fold:

 - It disables Windows path support if using the -m option, which
   seems a bit arbitrary.

 - It duplicates parts of the original do_cat function.

What's wrong with modifying do_cat so it checks the global inspector
variable?

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.