X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=blobdiff_plain;f=perl%2FGuestfs.xs;h=bcd7304fee1a3246ebada239b7d3f14e336c7ddb;hp=96b02f9b5fff327609a3a3b777f5d99276e6d5e8;hb=826020fe18bf2eee43f8afea392874bb88c0650a;hpb=0574eab8bc7d8e72db862ec36815835938a5fdf1 diff --git a/perl/Guestfs.xs b/perl/Guestfs.xs index 96b02f9..bcd7304 100644 --- a/perl/Guestfs.xs +++ b/perl/Guestfs.xs @@ -2386,10 +2386,10 @@ PREINIT: croak ("pvresize: %s", guestfs_last_error (g)); void -sfdisk_N (g, device, n, cyls, heads, sectors, line) +sfdisk_N (g, device, partnum, cyls, heads, sectors, line) guestfs_h *g; char *device; - int n; + int partnum; int cyls; int heads; int sectors; @@ -2397,7 +2397,7 @@ sfdisk_N (g, device, n, cyls, heads, sectors, line) PREINIT: int r; PPCODE: - r = guestfs_sfdisk_N (g, device, n, cyls, heads, sectors, line); + r = guestfs_sfdisk_N (g, device, partnum, cyls, heads, sectors, line); if (r == -1) croak ("sfdisk_N: %s", guestfs_last_error (g)); @@ -2650,3 +2650,123 @@ PREINIT: OUTPUT: RETVAL +SV * +wc_l (g, path) + guestfs_h *g; + char *path; +PREINIT: + int lines; + CODE: + lines = guestfs_wc_l (g, path); + if (lines == -1) + croak ("wc_l: %s", guestfs_last_error (g)); + RETVAL = newSViv (lines); + OUTPUT: + RETVAL + +SV * +wc_w (g, path) + guestfs_h *g; + char *path; +PREINIT: + int words; + CODE: + words = guestfs_wc_w (g, path); + if (words == -1) + croak ("wc_w: %s", guestfs_last_error (g)); + RETVAL = newSViv (words); + OUTPUT: + RETVAL + +SV * +wc_c (g, path) + guestfs_h *g; + char *path; +PREINIT: + int chars; + CODE: + chars = guestfs_wc_c (g, path); + if (chars == -1) + croak ("wc_c: %s", guestfs_last_error (g)); + RETVAL = newSViv (chars); + OUTPUT: + RETVAL + +void +head (g, path) + guestfs_h *g; + char *path; +PREINIT: + char **lines; + int i, n; + PPCODE: + lines = guestfs_head (g, path); + if (lines == NULL) + croak ("head: %s", guestfs_last_error (g)); + for (n = 0; lines[n] != NULL; ++n) /**/; + EXTEND (SP, n); + for (i = 0; i < n; ++i) { + PUSHs (sv_2mortal (newSVpv (lines[i], 0))); + free (lines[i]); + } + free (lines); + +void +head_n (g, nrlines, path) + guestfs_h *g; + int nrlines; + char *path; +PREINIT: + char **lines; + int i, n; + PPCODE: + lines = guestfs_head_n (g, nrlines, path); + if (lines == NULL) + croak ("head_n: %s", guestfs_last_error (g)); + for (n = 0; lines[n] != NULL; ++n) /**/; + EXTEND (SP, n); + for (i = 0; i < n; ++i) { + PUSHs (sv_2mortal (newSVpv (lines[i], 0))); + free (lines[i]); + } + free (lines); + +void +tail (g, path) + guestfs_h *g; + char *path; +PREINIT: + char **lines; + int i, n; + PPCODE: + lines = guestfs_tail (g, path); + if (lines == NULL) + croak ("tail: %s", guestfs_last_error (g)); + for (n = 0; lines[n] != NULL; ++n) /**/; + EXTEND (SP, n); + for (i = 0; i < n; ++i) { + PUSHs (sv_2mortal (newSVpv (lines[i], 0))); + free (lines[i]); + } + free (lines); + +void +tail_n (g, nrlines, path) + guestfs_h *g; + int nrlines; + char *path; +PREINIT: + char **lines; + int i, n; + PPCODE: + lines = guestfs_tail_n (g, nrlines, path); + if (lines == NULL) + croak ("tail_n: %s", guestfs_last_error (g)); + for (n = 0; lines[n] != NULL; ++n) /**/; + EXTEND (SP, n); + for (i = 0; i < n; ++i) { + PUSHs (sv_2mortal (newSVpv (lines[i], 0))); + free (lines[i]); + } + free (lines); +