ASCII pfiles

From: Jarhad Idanno (
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)

-  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!

Select your own custom email address for FREE! Get w/No Ads, 6MB, POP & more!

   | FAQ: |
   | Archives: |
   | Newbie List:   |

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