From d1df2f342489bbbba086cae2bb95971c8e404cad Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Tue, 19 May 2009 12:05:33 +0100 Subject: Added 'find' command. --- src/generator.ml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src') diff --git a/src/generator.ml b/src/generator.ml index 8ebfafbb..01a23095 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -2122,6 +2122,45 @@ is lost."); This resizes an ext2 or ext3 filesystem to match the size of the underlying device."); + ("find", (RStringList "names", [String "directory"]), 107, [], + [InitBasicFS, Always, TestOutputList ( + [["find"; "/"]], ["lost+found"]); + InitBasicFS, Always, TestOutputList ( + [["touch"; "/a"]; + ["mkdir"; "/b"]; + ["touch"; "/b/c"]; + ["find"; "/"]], ["a"; "b"; "b/c"; "lost+found"]); + InitBasicFS, Always, TestOutputList ( + [["mkdir_p"; "/a/b/c"]; + ["touch"; "/a/b/c/d"]; + ["find"; "/a/b/"]], ["c"; "c/d"])], + "find all files and directories", + "\ +This command lists out all files and directories, recursively, +starting at C. It is essentially equivalent to +running the shell command C but some +post-processing happens on the output, described below. + +This returns a list of strings I. Thus +if the directory structure was: + + /tmp/a + /tmp/b + /tmp/c/d + +then the returned list from C C would be +4 elements: + + a + b + c + c/d + +If C is not a directory, then this command returns +an error. + +The returned list is sorted."); + ] let all_functions = non_daemon_functions @ daemon_functions -- cgit