summaryrefslogtreecommitdiffstats
path: root/third_party/rust/lucet-wasi-wasmsbx/examples/hello.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/lucet-wasi-wasmsbx/examples/hello.c')
-rw-r--r--third_party/rust/lucet-wasi-wasmsbx/examples/hello.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/third_party/rust/lucet-wasi-wasmsbx/examples/hello.c b/third_party/rust/lucet-wasi-wasmsbx/examples/hello.c
new file mode 100644
index 0000000000..4b5ff49ec9
--- /dev/null
+++ b/third_party/rust/lucet-wasi-wasmsbx/examples/hello.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ char *greeting = getenv("GREETING");
+ if (greeting == NULL) {
+ greeting = "hello";
+ }
+
+ if (argc < 2) {
+ printf("%s, wasi!\n", greeting);
+ } else {
+ printf("%s, %s!\n", greeting, argv[1]);
+ }
+}