From: Richard W.M. Jones Date: Mon, 29 Jun 2009 09:08:25 +0000 (+0100) Subject: Implementation of 'wc_c', 'wc_w' and 'wc_l' commands. X-Git-Tag: 1.0.54~18 X-Git-Url: http://git.annexia.org/?p=libguestfs.git;a=commitdiff_plain;h=7613eb0c7c95649e2152a7fa4d1e6e5e8c653e96 Implementation of 'wc_c', 'wc_w' and 'wc_l' commands. These commands count characters, words and lines in a file respectively. --- diff --git a/daemon/Makefile.am b/daemon/Makefile.am index c84a563..b58ec3d 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -55,6 +55,7 @@ guestfsd_SOURCES = \ sync.c \ tar.c \ upload.c \ + wc.c \ zero.c \ zerofree.c \ ../src/guestfs_protocol.h \ diff --git a/src/generator.ml b/src/generator.ml index cd2f2a1..ccd68cf 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2473,6 +2473,33 @@ directory and its contents after use. See also: L"); + ("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 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 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 external command."); + ] let all_functions = non_daemon_functions @ daemon_functions