Annotation of libelwix/example/envargs.c, revision 1.1.1.1
1.1 misho 1: #include <stdio.h>
2: #include <elwix.h>
3:
4: extern char **environ;
5:
6: int
7: main(int argc, char **argv)
8: {
9: char **na, **args = argv + 1;
10: char **ne, **envs = environ;
11:
12: if (argc < 2)
13: return 1;
14:
15: printf("Show arguments::\n");
16: while (*args)
17: printf(" args=%s\n", *args++);
18: printf("---\n");
19: printf("Show environment::\n");
20: while (*envs)
21: printf(" envs=%s\n", *envs++);
22:
23: printf("--------------------\n");
24: printf("--------------------\n");
25: printf("--------------------\n");
26:
27: na = str_ExecArgs("piuk", (const char**) argv);
28: if (!na)
29: return 2;
30: else
31: args = na;
32: printf("EXEC arguments::\n");
33: while (*args)
34: printf(" args=%s\n", *args++);
35:
36: printf("---\n");
37:
38: ne = str_CopyEnv((const char**) environ);
39: if (!ne)
40: return 3;
41: else
42: envs = ne;
43: printf("COPY environment::\n");
44: while (*envs)
45: printf(" envs=%s\n", *envs++);
46:
47: printf("--------------------\n");
48:
49: str_FreeNullTerm(&na);
50: str_FreeNullTerm(&ne);
51: return 0;
52: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>