MCPcopy Create free account
hub / github.com/SimHacker/micropolis / env_init

Function env_init

micropolis-activity/src/sim/sim.c:132–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132void
133env_init(void)
134{
135 char dir[256];
136 char *s;
137 struct stat statbuf;
138 int lost = 0;
139
140 if ((s = getenv("SIMHOME")) == NULL) {
141 s = ".";
142 }
143 COPY(s, HomeDir);
144 TESTDIR(HomeDir, "$SIMHOME");
145
146 sprintf(dir, "%s/res/", HomeDir);
147 COPY(dir, ResourceDir);
148 TESTDIR(ResourceDir, "$SIMHOME/res");
149
150 { extern char *TCL_Library, *TK_Library;
151 TCL_Library = TK_Library = ResourceDir;
152 }
153
154 if (lost) {
155 fprintf(stderr,
156 "Please check the environment or reinstall Micropolis and try again! Sorry!\n");
157 sim_exit(1); // Just sets tkMustExit and ExitReturn
158 return;
159 }
160
161 gettimeofday(&now_time, NULL);
162 last_now_time = now_time;
163}
164
165
166void

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected