- static const char *ignored_options[] =
- { "message", "timeout", "default", NULL };
- const char **str;
-
- for (str = ignored_options; *str; str++)
- if (streq(*str, param))
- return 1;
- return 0;
-}
-
-/**
- * Splits a name=value pair, with value terminated by @term (or nul). if there
- * is no '=', then only the value is populated, and *name is set to NULL. The
- * string is modified in place.
- *
- * Returns the next byte to process, or null if we've hit the end of the
- * string.
- *
- * */
-static char *get_param_pair(char *str, char **name_out, char **value_out,
- char terminator)
-{
- char *sep, *tmp, *name, *value;
-
- /* terminate the value */
- tmp = strchr(str, terminator);
- if (tmp)
- *tmp = 0;
- else
- tmp = NULL;
-
- sep = strchr(str, '=');
- if (!sep) {
- *name_out = NULL;
- *value_out = str;
- return tmp ? tmp + 1 : NULL;
- }
-
- /* terminate the name */
- *sep = 0;
-
- /* remove leading spaces */
- for (name = str; isspace(*name); name++);
- for (value = sep + 1; isspace(*value); value++);
-
- /* .. and trailing ones.. */
- for (sep--; isspace(*sep); sep--)
- *sep = 0;
- for (sep = value + strlen(value) - 1; isspace(*sep); sep--)
- *sep = 0;
-
- *name_out = name;
- *value_out = value;
-
- return tmp ? tmp + 1 : NULL;
-}
-
-static struct global_option global_options[] = {
- { .name = "root" },
- { .name = "initrd" },
- { .name = "video" },
- { .name = NULL }
-};
-
-/*
- * Check if an option (name=value) is a global option. If so, store it in
- * the global options table, and return 1. Otherwise, return 0.
- */
-static int check_for_global_option(struct kboot_context *ctx,
- const char *name, const char *value)
-{
- int i;
-
- for (i = 0; i < ctx->n_global_options; i++) {
- if (!strcmp(name, ctx->global_options[i].name)) {
- global_options[i].value = strdup(value);
- break;
- }
- }
- return 0;
-}