Re: OLC & saveing OLC DATA

From: George Greer (greerga@circlemud.org)
Date: 01/02/01


On Tue, 2 Jan 2001, Patrick Dughi wrote:

>        Oasis only opens files while writing files for saving, and then
>closes them immediately. [...]
>
>        It would be a nice touch to make it more of an atomic command -
>written out to a temporary file, and just a rename to make the changes,
>but that's only if you're worried about crashes, I suppose.

OasisOLC does that:

[...stuff written up above...]
+  fputs("$\n", mobfd);
+  written = ftell(mobfd);
+  fclose(mobfd);
+  sprintf(usedfname, "%s%d.mob", MOB_PREFIX, vznum);
+  remove(usedfname);
+  rename(mobfname, usedfname);
+  remove_from_save_list(vznum, SL_MOB);
+  log("GenOLC: '%s' saved, %d bytes written.", usedfname, written);
+  return written;

--
George Greer            | If it's about the CircleMUD mailing list,
greerga@circlemud.org   | mail owner-circle@post.queensu.ca instead.

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST