diff --git a/unikernel-demo/io1/printf/Makefile b/unikernel-demo/io1/printf/Makefile new file mode 100644 index 00000000..ecd636b7 --- /dev/null +++ b/unikernel-demo/io1/printf/Makefile @@ -0,0 +1,3 @@ +export ukl-obj-m := main.o + +include ../../Makefile diff --git a/unikernel-demo/io1/printf/main.c b/unikernel-demo/io1/printf/main.c new file mode 100644 index 00000000..ea0d990c --- /dev/null +++ b/unikernel-demo/io1/printf/main.c @@ -0,0 +1,25 @@ +#include + +#ifndef USERSPACE +#define main ukl_main +#endif + +typedef struct { + char a; + char *b; + int c; +} test_t; + +int main(void) { + char str[250]; + test_t test = { + .a = 'a', + .b = "Hello!", + .c = 10 + }; + + printf("a = %c, b = %s, c = %d\n", test.a, test.b, test.c); + snprintf(str, sizeof(str), "a = %c, b = %s, c = %d\n", test.a, test.b, test.c); + puts(str); + return 0; +}