158 Commits

Author SHA1 Message Date
Richard Jones
3119aa687d fish: Allow -<<END as a syntax for uploading "heredocs".
For example:

    ><fs> upload -<<END /foo
    some data
    some more data
    END
    ><fs> cat /foo
    some data
    some more data
2010-04-19 15:08:45 +01:00
Richard Jones
92d38b9ae3 docs: Add virt-resize(1) link to guestfish(1) manpage. 2010-04-19 10:20:58 +01:00
Richard Jones
4f376dbafb fish: Print output from some commands in octal/hex as approp. (RHBZ#583242). 2010-04-17 12:33:31 +01:00
Richard Jones
c076aaea7e fish: Update documentation: Add another pipe example. 2010-04-13 21:26:47 +01:00
Richard Jones
c7c4a476a5 fish: Update documentation: Using 'lcd' command to change local directory. 2010-04-13 21:26:47 +01:00
Richard Jones
9a608a1516 Documentation updates.
Fix copyright years.
Fix URLs to point to new PRC site.
Make sure guestfish(1) and guestfs(3) manpages reference the
current list of tools.
2010-04-11 17:02:18 +01:00
Richard Jones
58abe782bf guestfish: Use xstrtol to parse integers (RHBZ#557655).
Current code uses atoi to parse the generator Int type and
atoll to parse the generator Int64 type.  The problem with the
ato* functions is that they don't cope with errors very well,
and they cannot parse numbers that begin with 0.. or 0x..
for octal and hexadecimal respectively.

This replaces the atoi call with a call to Gnulib xstrtol
and the atoll call with a call to Gnulib xstrtoll.

The generated code looks like this for all Int arguments:

  {
    strtol_error xerr;
    long r;

    xerr = xstrtol (argv[0], NULL, 0, &r, "");
    if (xerr != LONGINT_OK) {
      fprintf (stderr,
               _("%s: %s: invalid integer parameter (%s returned %d)\n"),
               cmd, "memsize", "xstrtol", xerr);
      return -1;
    }
    /* The Int type in the generator is a signed 31 bit int. */
    if (r < (-(2LL<<30)) || r > ((2LL<<30)-1)) {
      fprintf (stderr, _("%s: %s: integer out of range\n"), cmd, "memsize");
      return -1;
    }
    /* The check above should ensure this assignment does not overflow. */
    memsize = r;
  }

and like this for all Int64 arguments (note we don't need the
range check for these):

  {
    strtol_error xerr;
    long long r;

    xerr = xstrtoll (argv[1], NULL, 0, &r, "");
    if (xerr != LONGINT_OK) {
      fprintf (stderr,
               _("%s: %s: invalid integer parameter (%s returned %d)\n"),
               cmd, "size", "xstrtoll", xerr);
      return -1;
    }
    size = r;
  }

Note this also fixes an unrelated bug in guestfish handling of
RBufferOut.  We were using 'fwrite' without checking the return
value, and this could have caused silent failures, eg. in the case
where there was not enough disk space to store the resulting file,
or even if the program was interrupted (but continued) during the
write.

Replace this with Gnulib 'full-write', and check the return value
and report errors.
2010-01-25 12:07:34 +00:00
Richard Jones
8980c01b46 Move guestfs(3) and guestfish(1) man pages into subdirectories.
These manual pages have for a very long time 'lived' in the top
source directory.

Clean up this situation by moving those manual pages (plus associated
generated files) into the src/ and fish/ subdirectories respectively.
2009-12-31 12:26:04 +00:00