| 130 | |
| 131 | |
| 132 | void |
| 133 | env_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 | |
| 166 | void |