X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fgrub2%2Fbuiltins.c;h=668ed93aa10e6db074d3a7736d473f21446085dc;hb=6afcd04684c27823afc778f712006e02b7470faf;hp=2e63fcd09b0733e5fc2ea143f4aab2d79da9328e;hpb=9cf9430d5a1db0addd4788798fd7275d2c514f3c;p=petitboot diff --git a/discover/grub2/builtins.c b/discover/grub2/builtins.c index 2e63fcd..668ed93 100644 --- a/discover/grub2/builtins.c +++ b/discover/grub2/builtins.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "grub2.h" @@ -178,6 +178,7 @@ static bool builtin_test_op(int argc, char **argv, int *consumed) } } + op = argv[0]; *consumed = 1; return strlen(op) > 0; } @@ -231,6 +232,22 @@ static int builtin_test(struct grub2_script *script __attribute__((unused)), return rc ? 0 : 1; } +static int builtin_true(struct grub2_script *script __attribute__((unused)), + void *data __attribute__((unused)), + int argc __attribute__((unused)), + char *argv[] __attribute__((unused))) +{ + return 0; +} + +static int builtin_false(struct grub2_script *script __attribute__((unused)), + void *data __attribute__((unused)), + int argc __attribute__((unused)), + char *argv[] __attribute__((unused))) +{ + return 1; +} + static int builtin_nop(struct grub2_script *script __attribute__((unused)), void *data __attribute__((unused)), int argc __attribute__((unused)), @@ -239,6 +256,14 @@ static int builtin_nop(struct grub2_script *script __attribute__((unused)), return 0; } +extern int builtin_load_env(struct grub2_script *script, + void *data __attribute__((unused)), + int argc, char *argv[]); +int builtin_save_env(struct grub2_script *script, + void *data __attribute__((unused)), + int argc, char *argv[]); + + static struct { const char *name; grub2_function fn; @@ -271,6 +296,22 @@ static struct { .name = "test", .fn = builtin_test, }, + { + .name = "true", + .fn = builtin_true, + }, + { + .name = "false", + .fn = builtin_false, + }, + { + .name = "load_env", + .fn = builtin_load_env, + }, + { + .name = "save_env", + .fn = builtin_save_env, + }, }; static const char *nops[] = {