summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-29 10:08:25 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-29 10:08:25 +0100
commit7613eb0c7c95649e2152a7fa4d1e6e5e8c653e96 (patch)
tree39787d49bbbe171591cef6847ab48a93a7d5d566 /src
parent4585b0bbceb3ff73fcf2fbee554000b135297c19 (diff)
downloadlibguestfs-7613eb0c7c95649e2152a7fa4d1e6e5e8c653e96.tar.gz
libguestfs-7613eb0c7c95649e2152a7fa4d1e6e5e8c653e96.tar.xz
libguestfs-7613eb0c7c95649e2152a7fa4d1e6e5e8c653e96.zip
Implementation of 'wc_c', 'wc_w' and 'wc_l' commands.
These commands count characters, words and lines in a file respectively.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml
index cd2f2a1e..ccd68cff 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -2473,6 +2473,33 @@ directory and its contents after use.
See also: L<mkdtemp(3)>");
+ ("wc_l", (RInt "lines", [String "path"]), 118, [],
+ [InitBasicFS, Always, TestOutputInt (
+ [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"];
+ ["wc_l"; "/10klines"]], 10000)],
+ "count lines in a file",
+ "\
+This command counts the lines in a file, using the
+C<wc -l> external command.");
+
+ ("wc_w", (RInt "words", [String "path"]), 119, [],
+ [InitBasicFS, Always, TestOutputInt (
+ [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"];
+ ["wc_w"; "/10klines"]], 10000)],
+ "count words in a file",
+ "\
+This command counts the words in a file, using the
+C<wc -w> external command.");
+
+ ("wc_c", (RInt "chars", [String "path"]), 120, [],
+ [InitBasicFS, Always, TestOutputInt (
+ [["mount_vfs"; "ro"; "squashfs"; "/dev/sdd"; "/"];
+ ["wc_c"; "/100kallspaces"]], 102400)],
+ "count characters in a file",
+ "\
+This command counts the characters in a file, using the
+C<wc -c> external command.");
+
]
let all_functions = non_daemon_functions @ daemon_functions