summaryrefslogtreecommitdiffstats
path: root/perl
diff options
context:
space:
mode:
Diffstat (limited to 'perl')
-rw-r--r--perl/Guestfs.xs19
-rw-r--r--perl/lib/Sys/Guestfs.pm13
2 files changed, 32 insertions, 0 deletions
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs
index 8a6c4bb9..5905dc5e 100644
--- a/perl/Guestfs.xs
+++ b/perl/Guestfs.xs
@@ -2583,3 +2583,22 @@ PREINIT:
}
free (lines);
+void
+glob_expand (g, pattern)
+ guestfs_h *g;
+ char *pattern;
+PREINIT:
+ char **paths;
+ int i, n;
+ PPCODE:
+ paths = guestfs_glob_expand (g, pattern);
+ if (paths == NULL)
+ croak ("glob_expand: %s", guestfs_last_error (g));
+ for (n = 0; paths[n] != NULL; ++n) /**/;
+ EXTEND (SP, n);
+ for (i = 0; i < n; ++i) {
+ PUSHs (sv_2mortal (newSVpv (paths[i], 0)));
+ free (paths[i]);
+ }
+ free (paths);
+
diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm
index 9329b769..436f218c 100644
--- a/perl/lib/Sys/Guestfs.pm
+++ b/perl/lib/Sys/Guestfs.pm
@@ -676,6 +676,19 @@ For more information on states, see L<guestfs(3)>.
This returns the verbose messages flag.
+=item @paths = $h->glob_expand ($pattern);
+
+This command searches for all the pathnames matching
+C<pattern> according to the wildcard expansion rules
+used by the shell.
+
+If no paths match, then this returns an empty list
+(note: not an error).
+
+It is just a wrapper around the C L<glob(3)> function
+with flags C<GLOB_MARK|GLOB_BRACE>.
+See that manual page for more details.
+
=item $h->grub_install ($root, $device);
This command installs GRUB (the Grand Unified Bootloader) on