- if (!wa || !*wa) {
- i = DEFAULT_WRITER;
- cmdline = NULL;
- goto check;
- }
- PARA_INFO_LOG("checking %s\n", wa);
- FOR_EACH_WRITER(i) {
- const char *name = writer_names[i];
- size_t len = strlen(name);
- char c;
+/**
+ * Check if the given string is a valid command line for any writer.
+ *
+ * \param wa String of the form writer_name options.
+ * \param lprp Contains the parsed command line on success.
+ *
+ * If wa is \p NULL, the (configuration-dependent) default writer is assumed.
+ * Otherwise, the function checks whether \a wa starts with the name of a
+ * supported writer. If a valid writer name was found, the rest of the command
+ * line is passed to the config parser of this writer.
+ *
+ * \return On success, the positive writer ID is returned. Otherwise the
+ * function prints an error message and calls exit().
+ */
+int check_writer_arg_or_die(const char *wa, struct lls_parse_result **lprp)
+{
+ int ret, writer_num, argc;
+ char **argv = NULL, *errctx = NULL;
+ const struct lls_command *cmd;