Re: [CODE] Restring

From: Jeremy Music (wyld@users.midsouth.net)
Date: 02/03/99


On Wed, 3 Feb 1999, Cj Stremick wrote:

> Nah.  Look at "obj_file_elem" in structs.h and you'll see that not all
> object information is saved.  You, of course can change this structure to
> include the strings but you would need to either convert or wipe your rent
> files and the new "flavor" of rent files would become *very* fat.

Not terribly bigger, but a good argument in favor of ascii format because
then you can do something like:

sprintf( buf, "gzip -9fq %s", strsave );
system( buf );

and

sprintf( buf, "gzip -dfq %s", strsave );
system( buf );

I do this with my pfiles, saving ALL player info, ALL items they are
carrying (and all those items info) and my biggest player file is less than
10k (an immortal, over max on heavily colored items).

If you are worried about hanging on the sub-process (which shouldn't be a
problem using -f) you could use a custom system call such as:

MAILER CODE, this is just for the idea and may (will) have to be adjusted to
work right.

int custom_system (const char *command)
{
  int pid, status;

  if (command == 0)
    return 1;
  pid = fork();
  if (pid == -1)
    return -1;
  if (pid == 0)
  {
   char *argv[4];
   argv[0] = "sh";
   argv[1] = "-c";
   argv[2] = command;
   argv[3] = 0;
   execve("/bin/sh", argv, environ);
   exit(127);
  }
  do
  {
   if (waitpid(pid, &status, 0) == -1)
   {
    if (errno != EINTR)
    return -1;
   } else
   return status;
  }
 while(1);
}


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



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