ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
libc-setup.cc
Go to the documentation of this file.
1 #undef __OPTIMIZE__
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <errno.h>
5 
6 #include "libc-globals.h"
7 #include "dce-global-variables.h"
8 #include "libc.h"
9 
10 extern Libc g_libc; // this is initialized in libc.c
11 
12 extern char *__progname;
13 //extern char *program_invocation_name;
14 // extern char *__program_invocation_short_name;
15 
16 extern "C" {
17 
18 //extern char *__program_invocation_name;
19 //extern char *__program_invocation_short_name;
20 
22 {
23  struct DceGlobalVariables globals;
24  globals.pstdin = &stdin;
25  globals.pstdout = &stdout;
26  globals.pstderr = &stderr;
27  globals.penvp = &environ;
28  globals.poptarg = &optarg;
29  globals.popterr = &opterr;
30  globals.poptind = &optind;
31  globals.poptopt = &optopt;
32  globals.pprogname = &__progname;
33  globals.pprogram_invocation_name = &program_invocation_name;
34  globals.pprogram_invocation_short_name = &program_invocation_short_name;
35 
36  typedef void (*dce_global_variables_setup_t)(struct DceGlobalVariables *);
37  ((dce_global_variables_setup_t)g_libc.dce_global_variables_setup_fn)(&globals);
38 }
39 
40 }