Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: bug? archetype loading



Hi,

I suppose there is something wrong:

void load_archetypes() {
  FILE *fp;
  char filename[MAX_BUF];
  int comp;

  sprintf(filename,"%s/%s",settings.libdir,settings.archetypes);
  LOG(llevDebug,"Reading archetypes from %s...\n",filename);
  if((fp=open_and_uncompress(filename,0,&comp))==NULL) {
    LOG(llevError,"Can't open archetype file.\n");
    return;
  }
  /*setlinebuf (fp);*/
  clear_archetable();
  LOG(llevDebug,"arch-pass 1...");
  first_arch_pass(fp);
  LOG(llevDebug,"done\n");
  init_archetable();
  warn_archetypes=1;
  rewind(fp);

IIRC, if the file is compressed, it will be read from a pipe.
You can't rewind() a pipe. It seems more reasonable to
close and reopen the file.

Christian
[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]