comparison urogue/mdport.c @ 304:e52a8a7ad4c5

Fix many compiler warnings. There should only be two changes in behavior: arogue7/fight.c, arogue7/fight.c: a to-hit bonus is now correctly applied to characters who are not monks instead of monks who are not empty-handed. urogue/fight.c: fixed an interaction with the "debug" macro that could cause the wrong message to be displayed.
author John "Elwin" Edwards
date Wed, 14 Apr 2021 18:55:33 -0400
parents 5b6855d5d089
children 827441d05b3e
comparison
equal deleted inserted replaced
303:e06ebc407615 304:e52a8a7ad4c5
107 # define _puts(s) tputs(s, 0, putchar); 107 # define _puts(s) tputs(s, 0, putchar);
108 # define SO enter_standout_mode 108 # define SO enter_standout_mode
109 # define SE exit_standout_mode 109 # define SE exit_standout_mode
110 #endif 110 #endif
111 111
112 #ifdef _WIN32
112 static int md_standout_mode = 0; 113 static int md_standout_mode = 0;
114 #endif
113 115
114 void 116 void
115 md_raw_standout() 117 md_raw_standout()
116 { 118 {
117 #ifdef _WIN32 119 #ifdef _WIN32
279 if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath))) 281 if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath)))
280 h = szPath; 282 h = szPath;
281 #endif 283 #endif
282 284
283 if ( (h == NULL) || (*h == '\0') ) 285 if ( (h == NULL) || (*h == '\0') )
286 {
284 if ( (h = getenv("HOME")) == NULL ) 287 if ( (h = getenv("HOME")) == NULL )
288 {
285 if ( (h = getenv("HOMEDRIVE")) == NULL) 289 if ( (h = getenv("HOMEDRIVE")) == NULL)
286 h = ""; 290 h = "";
287 else 291 else
288 { 292 {
289 strncpy(homedir,h,PATH_MAX-1); 293 strncpy(homedir,h,PATH_MAX-1);
290 homedir[PATH_MAX-1] = 0; 294 homedir[PATH_MAX-1] = 0;
291 295
292 if ( (h = getenv("HOMEPATH")) == NULL) 296 if ( (h = getenv("HOMEPATH")) == NULL)
293 h = ""; 297 h = "";
294 } 298 }
299 }
300 }
295 301
296 302
297 len = strlen(homedir); 303 len = strlen(homedir);
298 strncat(homedir,h,PATH_MAX-len-1); 304 strncat(homedir,h,PATH_MAX-len-1);
299 len = strlen(homedir); 305 len = strlen(homedir);
370 /* 376 /*
371 * Set back to original user, just in case 377 * Set back to original user, just in case
372 */ 378 */
373 setuid(getuid()); 379 setuid(getuid());
374 setgid(getgid()); 380 setgid(getgid());
375 execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0); 381 execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", (char *) NULL);
376 perror("No shelly"); 382 perror("No shelly");
377 _exit(-1); 383 _exit(-1);
378 } 384 }
379 else /* Application */ 385 else /* Application */
380 { 386 {
599 #endif 605 #endif
600 { 606 {
601 avg[0] = avg[1] = avg[2] = 0.0; 607 avg[0] = avg[1] = avg[2] = 0.0;
602 return -1; 608 return -1;
603 } 609 }
610 return 3;
604 } 611 }
605 612
606 long 613 long
607 md_random() 614 md_random()
608 { 615 {