]> git.sur5r.net Git - i3/i3/blobdiff - include/util.h
i3test::XTEST: don’t “use i3test” to avoid clobbering state
[i3/i3] / include / util.h
index e5ba3341336e0ce6531bd5139b60e9091903bdd1..de6fa56850eb8f0ba8ba89c941b921a13796b61c 100644 (file)
@@ -69,6 +69,14 @@ Rect rect_sub(Rect a, Rect b);
  */
 __attribute__((pure)) bool name_is_digits(const char *name);
 
+/**
+ * Set 'out' to the layout_t value for the given layout. The function
+ * returns true on success or false if the passed string is not a valid
+ * layout name.
+ *
+ */
+bool layout_from_name(const char *layout_str, layout_t *out);
+
 /**
  * Parses the workspace name as a number. Returns -1 if the workspace should be
  * interpreted as a "named workspace".
@@ -149,3 +157,18 @@ void start_nagbar(pid_t *nagbar_pid, char *argv[]);
  *
  */
 void kill_nagbar(pid_t *nagbar_pid, bool wait_for_it);
+
+/**
+ * Converts a string into a long using strtol().
+ * This is a convenience wrapper checking the parsing result. It returns true
+ * if the number could be parsed.
+ */
+bool parse_long(const char *str, long *out, int base);
+
+/**
+ * Slurp reads path in its entirety into buf, returning the length of the file
+ * or -1 if the file could not be read. buf is set to a buffer of appropriate
+ * size, or NULL if -1 is returned.
+ *
+ */
+ssize_t slurp(const char *path, char **buf);