diff options
Diffstat (limited to 'perl')
-rw-r--r-- | perl/Guestfs.xs | 19 | ||||
-rw-r--r-- | perl/lib/Sys/Guestfs.pm | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs index 99eb3190..954d7e2e 100644 --- a/perl/Guestfs.xs +++ b/perl/Guestfs.xs @@ -623,3 +623,22 @@ aug_load (g) if (guestfs_aug_load (g) == -1) croak ("aug_load: %s", last_error); +void +aug_ls (g, path) + guestfs_h *g; + char *path; +PREINIT: + char **matches; + int i, n; + PPCODE: + matches = guestfs_aug_ls (g, path); + if (matches == NULL) + croak ("aug_ls: %s", last_error); + for (n = 0; matches[n] != NULL; ++n) /**/; + EXTEND (SP, n); + for (i = 0; i < n; ++i) { + PUSHs (sv_2mortal (newSVpv (matches[i], 0))); + free (matches[i]); + } + free (matches); + diff --git a/perl/lib/Sys/Guestfs.pm b/perl/lib/Sys/Guestfs.pm index 9fefb9a5..9f3dd5e9 100644 --- a/perl/lib/Sys/Guestfs.pm +++ b/perl/lib/Sys/Guestfs.pm @@ -212,6 +212,11 @@ Load files into the tree. See C<aug_load> in the Augeas documentation for the full gory details. +=item @matches = $h->aug_ls (path); + +This is just a shortcut for listing C<$h-E<gt>aug_match> +C<path/*> and sorting the files into alphabetical order. + =item @matches = $h->aug_match (path); Returns a list of paths which match the path expression C<path>. |