discover/grub2: Add true & false builtins
authorJeremy Kerr <jk@ozlabs.org>
Tue, 24 Sep 2013 06:08:46 +0000 (14:08 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 24 Sep 2013 06:08:46 +0000 (14:08 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/grub2/builtins.c

index 2e63fcd09b0733e5fc2ea143f4aab2d79da9328e..0716276e9bbf78bcafdfabce36e8c38bbcd8556e 100644 (file)
@@ -231,6 +231,22 @@ static int builtin_test(struct grub2_script *script __attribute__((unused)),
        return rc ? 0 : 1;
 }
 
        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)),
 static int builtin_nop(struct grub2_script *script __attribute__((unused)),
                void *data __attribute__((unused)),
                int argc __attribute__((unused)),
@@ -271,6 +287,14 @@ static struct {
                .name = "test",
                .fn = builtin_test,
        },
                .name = "test",
                .fn = builtin_test,
        },
+       {
+               .name = "true",
+               .fn = builtin_true,
+       },
+       {
+               .name = "false",
+               .fn = builtin_false,
+       },
 };
 
 static const char *nops[] = {
 };
 
 static const char *nops[] = {