forked from dmcgowan/containerd-wasm
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.c
48 lines (39 loc) · 971 Bytes
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/utsname.h>
extern char **environ;
int main(int argc, char *argv[]) {
struct utsname buffer;
errno = 0;
if (uname(&buffer) != 0) {
perror("uname");
exit(EXIT_FAILURE);
}
// Print system information
// http://man7.org/linux/man-pages/man2/uname.2.html
printf("OS name: %s\n", buffer.sysname);
printf("Hardware identifier: %s\n", buffer.machine);
printf("\n");
// Print arguments
printf("Arguments:\n");
for(int counter=0; counter<argc; counter++) {
printf("argv[%d]: %s\n",counter,argv[counter]);
}
printf("\n");
// Print environment
printf("Environment:\n");
char *s = *environ;
for (int i = 1; s; i++) {
printf("%s\n", s);
s = *(environ+i);
}
printf("\n");
int count = 0;
while(1) {
count++;
printf("Waiting 10 seconds (%d)...\n", count);
sleep(10);
}
return EXIT_SUCCESS;
}