comparison arogue7/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 17005af49963
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(void) 117 md_raw_standout(void)
116 { 118 {
117 #ifdef _WIN32 119 #ifdef _WIN32
295 if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath))) 297 if(SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, 0, szPath)))
296 h = szPath; 298 h = szPath;
297 #endif 299 #endif
298 300
299 if ( (h == NULL) || (*h == '\0') ) 301 if ( (h == NULL) || (*h == '\0') )
302 {
300 if ( (h = getenv("HOME")) == NULL ) 303 if ( (h = getenv("HOME")) == NULL )
304 {
301 if ( (h = getenv("HOMEDRIVE")) == NULL) 305 if ( (h = getenv("HOMEDRIVE")) == NULL)
302 h = ""; 306 h = "";
303 else 307 else
304 { 308 {
305 strncpy(homedir,h,PATH_MAX-1); 309 strncpy(homedir,h,PATH_MAX-1);
306 homedir[PATH_MAX-1] = 0; 310 homedir[PATH_MAX-1] = 0;
307 311
308 if ( (h = getenv("HOMEPATH")) == NULL) 312 if ( (h = getenv("HOMEPATH")) == NULL)
309 h = ""; 313 h = "";
310 } 314 }
315 }
316 }
311 317
312 318
313 len = strlen(homedir); 319 len = strlen(homedir);
314 strncat(homedir,h,PATH_MAX-len-1); 320 strncat(homedir,h,PATH_MAX-len-1);
315 len = strlen(homedir); 321 len = strlen(homedir);
376 /* 382 /*
377 * Set back to original user, just in case 383 * Set back to original user, just in case
378 */ 384 */
379 setuid(getuid()); 385 setuid(getuid());
380 setgid(getgid()); 386 setgid(getgid());
381 execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", 0); 387 execl(sh == NULL ? "/bin/sh" : sh, "shell", "-i", (char *) NULL);
382 perror("No shelly"); 388 perror("No shelly");
383 _exit(-1); 389 _exit(-1);
384 } 390 }
385 else /* Application */ 391 else /* Application */
386 { 392 {