+extern int number_is_in_list (const char *list, int number);
+
+/* Reverse S to the last non-whitespace character without skipping past
+ START. */
+
+extern const char *remove_trailing_whitespace (const char *start,
+ const char *s);
+
+/* Same, for non-const S. */
+
+static inline char *
+remove_trailing_whitespace (const char *start, char *s)
+{
+ return (char *) remove_trailing_whitespace (start, (const char *) s);
+}
+
+/* A helper function to extract an argument from *ARG. An argument is
+ delimited by whitespace. The return value is empty if no argument
+ was found. */
+
+extern std::string extract_arg (char **arg);
+
+/* A const-correct version of the above. */
+
+extern std::string extract_arg (const char **arg);
+
+/* A helper function that looks for an argument at the start of a
+ string. The argument must also either be at the end of the string,
+ or be followed by whitespace. Returns 1 if it finds the argument,
+ 0 otherwise. If the argument is found, it updates *STR. */
+extern int check_for_argument (const char **str, const char *arg, int arg_len);
+
+/* Same, for non-const STR. */
+
+static inline int
+check_for_argument (char **str, const char *arg, int arg_len)
+{
+ return check_for_argument (const_cast<const char **> (str),
+ arg, arg_len);
+}
+
+/* A helper function that looks for a set of flags at the start of a
+ string. The possible flags are given as a null terminated string.
+ A flag in STR must either be at the end of the string,
+ or be followed by whitespace.
+ Returns 0 if no valid flag is found at the start of STR.
+ Otherwise updates *STR, and returns N (which is > 0),
+ such that FLAGS [N - 1] is the valid found flag. */
+extern int parse_flags (const char **str, const char *flags);
+
+/* qcs_flags struct regroups the flags parsed by parse_flags_qcs. */
+
+struct qcs_flags
+{
+ bool quiet = false;
+ bool cont = false;
+ bool silent = false;
+};