Displaying 5 results from an estimated 5 matches for "read_config_from_file".
2014 Feb 17
2
[PATCH 1/2] fish: small refactor of config reading code
...-)
diff --git a/fish/config.c b/fish/config.c
index e9f437a..02d850b 100644
--- a/fish/config.c
+++ b/fish/config.c
@@ -42,87 +42,61 @@ static const char *etc_filename = "/etc/libguestfs-tools.conf";
* global handle 'g' is opened.
*/
-void
-parse_config (void)
+static void
+read_config_from_file (const char *filename)
{
- const char *home;
FILE *fp;
- config_t conf;
-
- config_init (&conf);
-
- /* Try $HOME first. */
- home = getenv ("HOME");
- if (home != NULL) {
- CLEANUP_FREE char *path = NULL;
- if (asprintf (&path, "%s/%s", home, home_file...
2016 Jul 22
1
[PATCH] static const char *str -> static const char str
...$HOME/ */ ".libguestfs-tools.rc";
-static const char *etc_filename = "/etc/" GLOBAL_CONFIG_FILENAME;
+static const char home_filename[] = /* $HOME/ */ ".libguestfs-tools.rc";
+static const char etc_filename[] = "/etc/" GLOBAL_CONFIG_FILENAME;
static void
read_config_from_file (const char *filename)
diff --git a/fish/fish.c b/fish/fish.c
index d2cf359..2ce2039 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -183,7 +183,7 @@ main (int argc, char *argv[])
enum { HELP_OPTION = CHAR_MAX + 1 };
- static const char *options = "a:c:d:Df:h::im:nN:rvVwx";
+ stati...
2016 Apr 04
2
[PATCH 1/2] Use 'error' function consistently throughout.
...t a/fish/config.c b/fish/config.c
index 51014bf..4463d9f 100644
--- a/fish/config.c
+++ b/fish/config.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <error.h>
#include <libintl.h>
#ifdef HAVE_LIBCONFIG
@@ -68,10 +69,8 @@ read_config_from_file (const char *filename)
exit (EXIT_FAILURE);
}
- if (fclose (fp) == -1) {
- perror (filename);
- exit (EXIT_FAILURE);
- }
+ if (fclose (fp) == -1)
+ error (EXIT_FAILURE, errno, "fclose: %s", filename);
config_lookup_bool (&conf, "read_o...
2016 Sep 08
4
[PATCH 0/3] Use gnulib's getprogname
Hi,
this series update libguestfs to a recent gnulib version, so that we
can use its new getprogname module, and solve altogether one of the
porting issues (the need for 'program_name' by the error module of
gnulib), and have a single way to get the name of the current program.
A number of changes in tools mostly, although mechanical.
Thanks,
Pino Toscano (3):
Update gnulib to latest
2015 Feb 14
2
[PATCH 0/2] Change guestfs__*
libguestfs has used double and triple underscores in identifiers.
These aren't valid for global names in C++.
(http://stackoverflow.com/a/228797)
These large but completely mechanical patches change the illegal
identifiers to legal ones.
Rich.