[OLC]

From: Arnold Santayana (matrim@KUENTOS.GUAM.NET)
Date: 03/30/98


Hello Again,

I've come across a strange bug (which I think you all have come across at
one point in time) I've "successfully" installed OasisOLC v 1.6b and
DGScripts(latest ver, I forget the number) Strangely tho after shutting
down my mud, the changes (that were saved online and onto the newindex
file) does not get copied over to the index files. This happens for all the
index files, and in turn makes the index file turn up empty, losing all of
the info it previously had.

Here's a snip of the code that deals with the index saving :

*snip*

void zedit_create_index(int znum, char *type)
{
  FILE *newfile, *oldfile;
  char new_name[32], old_name[32], *prefix;
  int num, found = FALSE;

  switch (*type) {
  case 'z':
    prefix = ZON_PREFIX;
    break;
  case 'w':
    prefix = WLD_PREFIX;
    break;
  case 'o':
    prefix = OBJ_PREFIX;
    break;
  case 'm':
    prefix = MOB_PREFIX;
    break;
  case 's':
    prefix = SHP_PREFIX;
    break;
 case 't':
   prefix = TRG_PREFIX;
   break;
 default:
   /*
    * Caller messed up
    */
   return;
 }

 sprintf(old_name, "%s/index", prefix);
 sprintf(new_name, "%s/newindex", prefix);

 if (!(oldfile = fopen(old_name, "r"))) {
   sprintf(buf, "SYSERR: OLC: Failed to open %s", buf);
   mudlog(buf, BRF, LVL_IMPL, TRUE);
   return;
 } else if (!(newfile = fopen(new_name, "w"))) {
   sprintf(buf, "SYSERR: OLC: Failed to open %s", buf);
   mudlog(buf, BRF, LVL_IMPL, TRUE);
   return;
 }

  /*
   * Index contents must be in order: search through the old file for the
   * right place, insert the new file, then copy the rest over.
   */
  sprintf(buf1, "%d.%s", znum, type);
  while (get_line(oldfile, buf)) {
    if (*buf == '$') {
      fprintf(newfile, "%s\n$\n", (!found ? buf1 : ""));
      break;
    } else if (!found) {
      sscanf(buf, "%d", &num);
      if (num > znum) {
found = TRUE;
        fprintf(newfile, "%s\n", buf1);
      }
    }
    fprintf(newfile, "%s\n", buf);
  }

  fclose(newfile);
  fclose(oldfile);
  /*
   * Out with the old, in with the new.
   */
  remove(old_name);
  rename(new_name, old_name);
}

*snip*

I think that is it. If anyone can shed some light on why the newindex
doesn't copy over the index, I would greatly appreciate your help.

Arnold


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST