- fclose(yaz_global_log_file);
- yaz_global_log_file = 0;
- MoveFileEx(cur_fname, newname, MOVEFILE_REPLACE_EXISTING);
+ yaz_log_close();
+#endif
+ for (i = 0; i<9; i++)
+ {
+ char fname_str[FILENAME_MAX];
+ struct stat stat_buf;
+
+ yaz_snprintf(fname_str, sizeof(fname_str), "%s.%d", cur_fname, i);
+ if (stat(fname_str, &stat_buf) != 0)
+ break;
+ }
+ for (; i >= 0; --i)
+ {
+ char fname_str[2][FILENAME_MAX];
+
+ if (i > 0)
+ yaz_snprintf(fname_str[0], sizeof(fname_str[0]),
+ "%s.%d", cur_fname, i-1);
+ else
+ yaz_snprintf(fname_str[0], sizeof(fname_str[0]),
+ "%s", cur_fname);
+ yaz_snprintf(fname_str[1], sizeof(fname_str[1]),
+ "%s.%d", cur_fname, i);
+#ifdef WIN32
+ MoveFileEx(fname_str[0], fname_str[1], MOVEFILE_REPLACE_EXISTING);