comparison arogue7/mdport.c @ 279:d3968e9cb98d

Use C stdio functions for score files and save files. Switching from Unix file descriptor operations to C standard FILE* functions will reduce portability problems.
author John "Elwin" Edwards
date Fri, 15 Sep 2017 19:57:54 -0400
parents 3d4252fa2ed3
children 8b6aba552f6f
comparison
equal deleted inserted replaced
278:c222f9d56776 279:d3968e9cb98d
153 fflush(stdout); 153 fflush(stdout);
154 #endif 154 #endif
155 } 155 }
156 156
157 int 157 int
158 md_unlink_open_file(char *file, int inf) 158 md_unlink_open_file(char *file, FILE *inf)
159 { 159 {
160 #ifdef _WIN32 160 #ifdef _WIN32
161 close(inf); 161 fclose(inf);
162 chmod(file, 0600); 162 chmod(file, 0600);
163 return( _unlink(file) ); 163 return( _unlink(file) );
164 #else 164 #else
165 return(unlink(file)); 165 return(unlink(file));
166 #endif 166 #endif
675 #else /* USG5_2.... curses */ 675 #else /* USG5_2.... curses */
676 flushinp(); 676 flushinp();
677 #endif 677 #endif
678 } 678 }
679 679
680 extern int scorefd;
681 extern char score_file[];
682
683 void
684 md_reopen_score(void)
685 {
686 if (scorefd > 0)
687 close(scorefd);
688 scorefd = open(score_file, O_RDWR | O_CREAT, 0666);
689 }
690
691 /* 680 /*
692 Cursor/Keypad Support 681 Cursor/Keypad Support
693 682
694 Sadly Cursor/Keypad support is less straightforward than it should be. 683 Sadly Cursor/Keypad support is less straightforward than it should be.
695 684