Mercurial > hg > early-roguelike
comparison urogue/save.c @ 272:1db299e868b8
UltraRogue: add the autosave feature.
UltraRogue now automatically saves the game when SIGHUP or SIGTERM is
received.
| author | John "Elwin" Edwards | 
|---|---|
| date | Sun, 03 Sep 2017 19:58:22 -0400 | 
| parents | ac42afd962e4 | 
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 271:88bd51f231e7 | 272:1db299e868b8 | 
|---|---|
| 113 msg(""); | 113 msg(""); | 
| 114 return(FALSE); | 114 return(FALSE); | 
| 115 } | 115 } | 
| 116 } | 116 } | 
| 117 | 117 | 
| 118 void | |
| 119 auto_save(int sig) | |
| 120 { | |
| 121 FILE *savef; | |
| 122 | |
| 123 md_ignore_signals(); | |
| 124 if (file_name[0] && (savef = fopen(file_name, "w"))) { | |
| 125 save_file(savef); | |
| 126 } | |
| 127 exit(0); | |
| 128 } | |
| 129 | |
| 118 int | 130 int | 
| 119 restore(char *file) | 131 restore(char *file) | 
| 120 { | 132 { | 
| 121 FILE *infd; | 133 FILE *infd; | 
| 122 char *sp; | 134 char *sp; | 
