summaryrefslogtreecommitdiffstats
path: root/fish
Commit message (Collapse)AuthorAgeFilesLines
* Set locale in C programs so l10n works (RHBZ#559962).Richard Jones2010-01-292-0/+5
| | | | | | | | | | | | | | | This commit adds the calls to setlocale &c to all of the current C programs. It also adds l10n support to hivexget and hivexml which lacked them previously. To test this, try: LANG=pa_IN.UTF-8 guestfish --cmd-help (You can only do this test after installing the package, or at least the 'pa.mo' mo-file in the correct place).
* guestfish: Use xstrtol to parse integers (RHBZ#557655).Richard Jones2010-01-251-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add guestfs.pod and guestfish.pod to EXTRA_DIST.1.0.81Richard Jones2010-01-131-1/+2
|
* Move guestfs(3) and guestfish(1) man pages into subdirectories.Richard Jones2009-12-312-1/+768
| | | | | | | | 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.
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 in "usage", tooJim Meyering2009-11-201-2/+2
| | | | | | | | | | Convert by running these commands: perl -pi -e 's/\b(usage ?)\(1\)/$1(EXIT_FAILURE)/' \ fish/fish.c fuse/guestmount.c perl -pi -e 's/\b(usage ?)\(0\)/$1(EXIT_SUCCESS)/' \ fish/fish.c fuse/guestmount.c * fish/fish.c (main): Replace 0/1 with EXIT_SUCCESS/EXIT_FAILURE. * fuse/guestmount.c (main): Likewise.
* maint: use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1 to exitJim Meyering2009-11-203-50/+50
| | | | | | | | | | | | | | | Convert all uses automatically, via these two commands: git grep -l '\<exit *(1)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(1\)/$1(EXIT_FAILURE)/' git grep -l '\<exit *(0)' \ | grep -vEf .x-sc_prohibit_magic_number_exit \ | xargs --no-run-if-empty \ perl -pi -e 's/\b(exit ?)\(0\)/$1(EXIT_SUCCESS)/' * .x-sc_prohibit_magic_number_exit: New file. Edit (RWMJ): Don't change Java code.
* build: Fix inter-directory dependenciesMatthew Booth2009-11-191-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds an explicit dependency on generator.ml for every file it generates, except java files. Java is left for another time because it's considerably trickier. It also adds a build rule for src/libguestfs.la so it can be rebuilt as required from other directories. It does this by creating a top level make file, subdir-rules.mk, which can be included from sub-directories. sub-directories need to define 'generator_built' to include local files which are built by generator.ml, and they will be updated automatically. This fixes parallel make, and will automatically re-create generated files when make is run from any directory. It also fixes the problem which efad4f53 was targetting. Specifically, src/guestfs_protocol.(c|h) had an erroneous dependency on stamp-generator, and therefore generator.ml, despite not being directly created by it. This caused them to be recreated every time generator.ml ran rather than only when src/guestfs_protocol.x was updated, which cascaded into a daemon and therefore appliance update. This patch also changes the contents of the distribution tarball by including files created by rpcgen.
* fish: Improve output of guestfish -h cmdRichard Jones2009-11-171-1/+1
| | | | | | Display this output like a short manual page. Don't put <..> around the parameters to the command.
* Don't export STREQ and friends in <guestfs.h>Richard Jones2009-11-101-0/+10
| | | | | Move these to private header file(s) and other places as required since these aren't part of the public API.
* Fix compilation if readline library is not present.Richard Jones2009-11-101-0/+4
|
* change strncasecmp() == 0 to STRCASEEQLEN()Jim Meyering2009-11-092-2/+2
| | | | | git grep -l 'strncasecmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrncasecmp( *\(.*?\)) *== *0\b/STRCASEEQLEN$1/g'
* change strncasecmp() == 0 to STRCASENEQLEN()Jim Meyering2009-11-091-1/+1
| | | | | git grep -l 'strncasecmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrncasecmp( *\(.*?\)) *!= *0\b/STRCASENEQLEN$1/g'
* use STREQ, not strcmp: part 2Jim Meyering2009-11-093-4/+4
| | | | | git grep -l 'strcmp *([^=]*!= *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *!= *0\b/STRNEQ$1/g'
* use STREQ, not strcmp: part 1Jim Meyering2009-11-092-5/+5
| | | | | git grep -l 'strcmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g'
* change strncmp() == 0 to STREQLEN()Jim Meyering2009-11-093-3/+3
| | | | | git grep -l 'strncmp *([^=]*== *0'|xargs \ perl -pi -e 's/\bstrncmp( *\(.*?\)) *== *0\b/STREQLEN$1/g'
* convert strcasecmp(...) != 0 to STRCASENEQ(...)Jim Meyering2009-11-091-5/+5
| | | | | git grep -E -l 'strcasecmp *\(.*!= ?0\b'|xargs \ perl -pi -e 's/\bstrcasecmp( ?\(.*?\)) != 0/STRCASENEQ$1/g'
* convert uses of strcasecmp to STRCASEEQJim Meyering2009-11-093-37/+37
| | | | | git grep -l 'strcasecmp *([^=]*== *0'| xargs \ perl -pi -e 's/\bstrcasecmp( *\(.*?\)) *== *0/STRCASEEQ$1/'
* Fixes for compiling on 32 bit.Richard W.M. Jones2009-11-061-7/+7
|
* fish: Allow <nn>P and <nn>E for petabyte and exabyte allocations.Richard Jones2009-11-042-0/+6
|
* fish: Allow <nn>T for terabyte allocations.Richard Jones2009-11-042-3/+6
|
* fish: New command 'sparse', like 'alloc' but to generate sparse files.Richard Jones2009-11-043-0/+83
| | | | | | | | | | | | | | | | | With sparse you can make sparse files, which is fun because you can experiment with really large devices: ><fs> sparse /tmp/test.img 100G ><fs> run ><fs> sfdiskM /dev/vda , ><fs> mkfs ext2 /dev/vda1 # very long pause here ... ><fs> mount /dev/vda1 / To see the real (ie. allocated) size of the sparse file, use the du command, eg: ><fs> !du -h /tmp/test.img 1.6G -rw-rw-r-- 1 rjones rjones 100G 2009-11-04 17:40 /tmp/test.img
* guestfish: Add win: prefix to use Windows paths.Richard Jones2009-10-262-0/+49
| | | | | | | Add a win: prefix for path arguments in guestfish: ><fs> file win:c:\windows\system32\config\system.log MS Windows registry file, NT/2000 or above
* avoid use of all ctype macrosJim Meyering2009-09-242-4/+3
| | | | | | | | | | | | | | | | | | | | * cfg.mk (disable_temporarily): Don't disable sc_avoid_ctype_macros. * fish/tilde.c: Remove unnecessary inclusion of ctype.h. * bootstrap: Add gnulib's c-ctype module to the list. * daemon/m4/gnulib-cache.m4: Likewise. * daemon/ext2.c: Include "c-ctype.h", not <ctype.h>. Use c_isspace, etc, rather than isspace. * daemon/guestfsd.c: Likewise. * daemon/lvm.c: Likewise. * daemon/proto.c: Likewise. * fish/fish.c: Likewise. * fish/tilde.c: Likewise. * src/generator.ml: Likewise. * src/guestfs.c: Likewise. * examples/to-xml.c: Likewise. * examples/Makefile.am (to_xml_CPPFLAGS): Add -I$(top_srcdir)/gnulib/lib so inclusion of "c-ctype.h" works. (to_xml_CPPFLAGS): Rename from to_xml_CFLAGS.
* Remove guestfs_wait_ready (turn it into a no-op).Richard Jones2009-09-211-2/+0
| | | | | | | | | | | | | | This commit changes guestfs_launch so that it both launches the appliance and waits until it is ready (ie. the daemon communicates back to us). Since we removed the pretence that we could implement a low-level asynchronous API, the need to call launch() followed by wait_ready() has looked a bit silly. Now guestfs_wait_ready() is basically a no-op. It is left in the API for backwards compatibility. Any calls to guestfs_wait_ready() can be removed from client code.
* Move decl out for C99 compliance.Richard Jones2009-09-141-1/+3
|
* Fix type punning warning about use of CMSG_DATA in Rawhide.Richard Jones2009-09-141-2/+4
|
* guestfish: Enable grouping in string listsMatthew Booth2009-09-141-17/+133
| | | | | | | | | | | | | | | | | | | | | | This change adds the ability to group entries in a string list with single quotes. So the string: "'foo bar'" becomes 1 token rather than 2. Consequently single quotes must now be escaped: "\'" resolves to a literal single quote. Incidentally, this change also alters another, probably unintentional behaviour of the previous implementation, in that tokens are separated by any amount of whitespace rather than a single whitespace character. I.e.: "a b" resolves to: 'a' 'b' rather than: 'a' '' 'b' That last syntax can be used if an empty argument is still desired. Whitespace is now also defined to include tabs. parse_string_list can also now fail if it contains an unmatched open quote.
* guestfish: Redirect stdout when executing remote commandsMatthew Booth2009-09-141-8/+126
| | | | | | | | | | | guestfish --listen necessarily redirects its stdout to /dev/null so as not to interfere with eval. The remote protocol doesn't contain any other provision for collecting stdout for the caller, so executing guestfish --remote will never generate any output. This patch fixes that by forwarding the caller's STDOUT to the listener over the unix socket connection. The listener redirects its STDOUT to the caller's STDOUT for the duration of the command, then closes it again.
* build: don't define _GNU_SOURCE manuallyJim Meyering2009-08-242-4/+0
| | | | | | | | | | | | Now that we're using gnulib in earnest, any manual definition would provoke a redefinition warning. * fish/fish.c (_GNU_SOURCE): Don't define. * fish/destpaths.c (_GNU_SOURCE): Likewise. * src/guestfs.c (_GNU_SOURCE): Likewise. * bootstrap (modules): Add asprintf, strchrnul, strerror, strndup and vasprintf. * fish/fish.c (main): Set argv[0] to sanitized program_name, so functions like getopt_long that use argv[0] use the clean name.
* guestfish: diagnose stdout write failureJim Meyering2009-08-241-0/+3
| | | | | | | | Use gnulib's closeout module to ensure any failure to write to stdout is detected and reported. * fish/fish.c: Include "closeout.h". (main): Call atexit (close_stdout); * bootstrap (modules): Add closeout.
* guestfish: don't try to diagnose getopt failureJim Meyering2009-08-241-2/+0
| | | | | * fish/fish.c: ... getopt_long already does that. Instead, suggest "Try `guestfish --help' for more information."
* guestfish: write --help to stdout, use gnulib's progname moduleJim Meyering2009-08-242-45/+92
| | | | | | | | | | * fish/fish.c: Include "progname.h". (main): Call set_program_name to initialize. Don't hard-code guestfish everywhere. Use program_name. However, be careful when modifying argv[0], since it is used in the hopes that it is an absolute file name. (usage): Don't spew all of --help for a mis-typed option. Split long lines.
* fish/: enable -Werror and all of gcc's warning optionsJim Meyering2009-08-211-2/+2
| | | | * fish/Makefile.am: Use $(WARN_CFLAGS) $(WERROR_CFLAGS).
* destpaths.c: avoid signed/unsigned-comparison warningJim Meyering2009-08-211-1/+1
| | | | * fish/destpaths.c (free_words): Change param type: s/int/size_t/.
* fish.c: don't perform arithmetic on void* pointersJim Meyering2009-08-211-1/+2
| | | | * fish/fish.c (xwrite): Use char*.
* fish.c: avoid signed/unsigned-comparison warningJim Meyering2009-08-211-2/+2
| | | | * fish/fish.c (script): Change type of index to "unsigned int".
* fish.c: avoid "assignment discards qualifiers..." warningJim Meyering2009-08-212-1/+7
| | | | | * fish/fish.c (main): Cast-away-const. * fish/fish.h (bad_cast): Define. Safer than using an actual cast.
* tilde.c: avoid a warningJim Meyering2009-08-211-5/+3
| | | | | * fish/tilde.c (find_home_for_username): Change param type: s/int/size_t/ (try_tilde_expansion): Adjust caller.
* fish.c: avoid warningsJim Meyering2009-08-212-3/+1
| | | | | * fish/rc.c (UNIX_PATH_MAX): Remove unused definition. * fish/fish.h (rc_listen): Declare with __attribute__((noreturn)).
* edit.c: avoid warning about signed/unsigned comparisonJim Meyering2009-08-211-2/+3
| | | | | * fish/edit.c (load_file): Change type of param from int to size_t. (do_edit): Adjust caller.
* guestfish: detect more failed syscallsJim Meyering2009-08-191-8/+33
| | | | * fish/fish.c (issue_command): Detect/diagnose more failed syscalls.
* avoid compiler warnings about unused vars in generated codeJim Meyering2009-08-181-2/+10
| | | | | | | * fish/Makefile.am: Compile rc_protocol.c into a convenience library, so it can have its own CFLAGS, and link that into guestfish. generator.ml: Use TABs, not spaces for indentation.
* adjust const "**" pointers to avoid warningsJim Meyering2009-08-172-6/+6
| | | | | | Also, ... * src/generator.ml: Add DeviceList type, and propagate that change out to all calling/interface code.
* guestfish: Add --selinux option.Richard Jones2009-08-131-2/+7
|
* fish: don't read freed memoryJim Meyering2009-08-121-4/+4
| | | | | | | * fish/rc.c (rc_remote): Close file handle only *after* xdr_destroy, because that latter may flush its file handle (implicated via xdrstdio_create). FYI, this failure is triggered for me only when MALLOC_PERTURB_ is set to nonzero < 256 in my environment.
* Fix: segfault in tab completion (RHBZ#516024).Richard Jones2009-08-061-2/+2
| | | | | Actually this fixes two bugs: 'strs' was not being freed on every path, and the tab completion segfault described in the bug report.
* Convert all TABs-as-indentation to spaces.Jim Meyering2009-08-037-361/+361
| | | | | | | | | | | Do it by running this command: [exempted files are matched via .x-sc_TAB_in_indentation] git ls-files \ | pcregrep -vf .x-sc_TAB_in_indentation \ | xargs pcregrep -l '^ *\t' \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
* build: reenable "syntax-check" rule: sc_const_long_optionJim Meyering2009-08-031-1/+1
| | | | | | | * cfg.mk (disable_temporarily): Remove sc_const_long_option. * daemon/guestfsd.c (main): Declare long_options to be "const". * fish/fish.c (main): Likewise. * test-tool/test-tool.c (main): Likewise.
* guestfish: Make more strings translatable.Richard Jones2009-07-292-6/+4
| | | | | However this doesn't yet attempt to translate the POD command documentation. We need a plan to do that.
* guestfish -iv should print virt-inspector command (for debugging).Richard W.M. Jones2009-07-241-1/+3
|