-
Notifications
You must be signed in to change notification settings - Fork 5
/
hello.c
30 lines (25 loc) · 623 Bytes
/
hello.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
#ifndef NOLIBC
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#endif
char **environ;
int main(int argc, char **argv, char **envp)
{
int ret;
int err;
environ = envp;
printf("pid : <%d>\n", getpid());
printf("arg1: <%ld>\n", argc > 1 ? atol(argv[1]) : 0);
ret = printf("msg : <%s>\n", argc > 2 ? argv[2] : "hello");
err = errno;
printf("ret : <%d>\n", ret);
printf("err : <%d>\n", err);
printf("argc: <%d>\n", argc);
printf("argv: <%s>\n", argv[0]);
printf("envp: <%s>\n", envp[0] ? envp[0] : "none");
printf("PATH: <%s>\n", getenv("PATH"));
return 0;
}