comparison arogue7/main.c @ 252:3d4252fa2ed3

Use more portable random seed generation. The new function md_random_seed() has replaced time() + getpid() and similar methods. Putting everything in mdport.c slightly reduces the warnings and workarounds.
author John "Elwin" Edwards
date Sat, 28 Jan 2017 15:49:41 -0500
parents e1cd27c5464f
children d3968e9cb98d
comparison
equal deleted inserted replaced
251:e7862a021609 252:3d4252fa2ed3
45 45
46 int 46 int
47 main(int argc, char *argv[], char *envp[]) 47 main(int argc, char *argv[], char *envp[])
48 { 48 {
49 register char *env; 49 register char *env;
50 int lowtime;
51 time_t now;
52 #ifdef PC7300 50 #ifdef PC7300
53 int hardwindow; /* Do we have a hardware window? */ 51 int hardwindow; /* Do we have a hardware window? */
54 #endif 52 #endif
55 53
56 md_init(); 54 md_init();
177 md_normaluser(); 175 md_normaluser();
178 } 176 }
179 if (argc == 2) 177 if (argc == 2)
180 if (!restore(argv[1], envp)) /* Note: restore will never return */ 178 if (!restore(argv[1], envp)) /* Note: restore will never return */
181 exit(1); 179 exit(1);
182 lowtime = (int) time(&now);
183 dnum = (wizard && getenv("SEED") != NULL ? 180 dnum = (wizard && getenv("SEED") != NULL ?
184 atoi(getenv("SEED")) : 181 atoi(getenv("SEED")) :
185 lowtime + getpid()); 182 md_random_seed());
186 if (wizard) 183 if (wizard)
187 printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum); 184 printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum);
188 else 185 else
189 printf("Hello %s, just a moment while I dig the dungeon...\n", whoami); 186 printf("Hello %s, just a moment while I dig the dungeon...\n", whoami);
190 fflush(stdout); 187 fflush(stdout);