Ticket #303: envtest2.c

File envtest2.c, 490 bytes (added by KO Myung-Hun, 10 years ago)

child program of testcase

Line 
1#include <stdio.h>
2#include <string.h>
3
4int main( int argc, char *argv[], char *envp[])
5{
6 int envsize;
7 int i;
8 FILE *fp;
9
10 for( envsize = 0, i = 0; envp[ i ]; i++ )
11 envsize += strlen( envp[ i ]) + 1;
12
13 fprintf(stderr, "COMSPEC = %s, envsize = %d\n", getenv("COMSPEC"), envsize);
14
15 fp = fopen("envtest2.log", "wt");
16
17 for( i = 0; envp[ i ]; i++ )
18 {
19 fprintf(fp, "%s\n", envp[ i ]);
20 }
21
22 fclose( fp );
23
24 return 0;
25}