ASCII pfiles

From: Jarhad Idanno (Jarhad@webmail.merging.org)
Date: 04/02/03


Ever looked at your pfiles directory and noticed all the pfiles
left behind after players have been removed/deleted from the game?
It was a hassle for me to manually delete all those leftover
pfiles, until I fixed it to be automatic, as shown below:

In db.c, under void remove_player(int pfilepos)

  if (!*player_table[pfilepos].name)
    return;

-  unlink(pfile_name);
+  snprintf(pfile_name, sizeof(pfile_name), "%s%s%c%s%s%s", PLR_PREFIX, SLASH,
+    *player_table[pfilepos].name, SLASH, player_table[pfilepos].name, PLR_SUFFIX);
+  if (remove(pfile_name) < 0 && errno != ENOENT)
+    log("SYSERR: deleting player file: %s : %s", pfile_name, strerror(errno));

  /* Unlink any other player-owned files here if you have them  */



I hope this helps anyone using ASCII pfiles.

Jarhad Idanno

_____________________________________________________________
Play at A Merging of Fates MUD and get free E-Mail too! http://www.merging.org

_____________________________________________________________
Select your own custom email address for FREE! Get you@yourchoice.com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/26/03 PDT