1 | // SPDX-License-Identifier: GPL-3.0-or-later |
2 | |
3 | #include <stdio.h> |
4 | |
5 | int main(int argc, const char *argv[]) |
6 | { |
7 | puts(string: "Hello, world from mlibc-based userspace" ); |
8 | |
9 | for (int i = 0; i < argc; i++) |
10 | printf(format: "argv[%d] = %s\n" , i, argv[i]); |
11 | |
12 | // dump all env vars |
13 | puts(string: "environment variables:" ); |
14 | extern char **environ; |
15 | char **env = environ; |
16 | size_t nenv = 0; |
17 | while (*env) |
18 | { |
19 | nenv++; |
20 | printf(format: "env: %s\n" , *env); |
21 | env++; |
22 | } |
23 | |
24 | printf(format: "total env vars: %zu\n" , nenv); |
25 | |
26 | return 0; |
27 | } |
28 | |