diff options
author | Richard Jones <rjones@trick.home.annexia.org> | 2009-09-09 17:48:30 +0100 |
---|---|---|
committer | Richard Jones <rjones@trick.home.annexia.org> | 2009-09-14 11:23:52 +0100 |
commit | f04ee08806ec7bd313e9d54f48f2eb911fcb3067 (patch) | |
tree | 45e0be08d13b1975539cd5504b4d9275df216d3c /src/guestfs.c | |
parent | 7f2ac369f7747a033f5e84d8c7fb3aa131f25537 (diff) | |
download | libguestfs-f04ee08806ec7bd313e9d54f48f2eb911fcb3067.tar.gz libguestfs-f04ee08806ec7bd313e9d54f48f2eb911fcb3067.tar.xz libguestfs-f04ee08806ec7bd313e9d54f48f2eb911fcb3067.zip |
Add command trace functionality.
Enable this by calling guestfs_trace (handle, 1) or by
setting the LIBGUESTFS_TRACE=1 environment variable.
Diffstat (limited to 'src/guestfs.c')
-rw-r--r-- | src/guestfs.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/guestfs.c b/src/guestfs.c index 571205f2..98d99b84 100644 --- a/src/guestfs.c +++ b/src/guestfs.c @@ -170,6 +170,7 @@ struct guestfs_h int cmdline_size; int verbose; + int trace; int autosync; char *path; /* Path to kernel, initrd. */ @@ -238,6 +239,9 @@ guestfs_create (void) str = getenv ("LIBGUESTFS_DEBUG"); g->verbose = str != NULL && strcmp (str, "1") == 0; + str = getenv ("LIBGUESTFS_TRACE"); + g->trace = str != NULL && strcmp (str, "1") == 0; + str = getenv ("LIBGUESTFS_PATH"); g->path = str != NULL ? strdup (str) : strdup (GUESTFS_DEFAULT_PATH); if (!g->path) goto error; @@ -734,6 +738,19 @@ guestfs__version (guestfs_h *g) return r; } +int +guestfs__set_trace (guestfs_h *g, int t) +{ + g->trace = !!t; + return 0; +} + +int +guestfs__get_trace (guestfs_h *g) +{ + return g->trace; +} + /* Add a string to the current command line. */ static void incr_cmdline_size (guestfs_h *g) |