diff options
author | Daniil Baturin <daniil@baturin.org> | 2024-11-07 18:02:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-07 18:02:08 +0000 |
commit | 196fdd7fdf6dcf751b7364c59e34278bfd0193e3 (patch) | |
tree | cfeff0991481c8281e24cf1698b20a76854059a4 /src/util.ml | |
parent | dd9271b4304c6b1a5a2576821d1b2b8fd3aa6bf5 (diff) | |
parent | 9b90d3cc4da72c13ef4270150e4b547ff03fc813 (diff) | |
download | vyconf-196fdd7fdf6dcf751b7364c59e34278bfd0193e3.tar.gz vyconf-196fdd7fdf6dcf751b7364c59e34278bfd0193e3.zip |
Merge pull request #11 from jestabro/vyconf-minimal
T6718: use the vyconf daemon for validation of set commands
Diffstat (limited to 'src/util.ml')
-rw-r--r-- | src/util.ml | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/util.ml b/src/util.ml deleted file mode 100644 index c4bbd96..0000000 --- a/src/util.ml +++ /dev/null @@ -1,38 +0,0 @@ -(** The unavoidable module for functions that don't fit anywhere else *) - -(** Find a child node in xml-lite *) -let find_xml_child name xml = - let find_aux e = - match e with - | Xml.Element (name', _, _) when name' = name -> true - | _ -> false - in - match xml with - | Xml.Element (_, _, children) -> Vylist.find find_aux children - | Xml.PCData _ -> None - -(** Convert a list of strings to a string of unquoted, space separated words *) -let string_of_list ss = - let rec aux xs acc = - match xs with - | [] -> acc - | x :: xs' -> aux xs' (Printf.sprintf "%s %s" acc x) - in - match ss with - | [] -> "" - | x :: xs -> Printf.sprintf "%s%s" x (aux xs "") - -(** Convert a list of strings to JSON *) -let json_of_list ss = - let ss = List.map (fun x -> `String x) ss in - Yojson.Safe.to_string (`List ss) - -(** Convert a relative path to an absolute path based on the current working directory *) -let absolute_path relative_path = - FilePath.make_absolute (Sys.getcwd ()) relative_path - -(** Makes a hex dump of a byte string *) -let hexdump b = - let dump = ref "" in - Bytes.iter (fun c -> dump := Char.code c |> Printf.sprintf "%s %02x" !dump) b; - !dump |