On Friday 16 May 2003 11:58, Pell, Blake wrote:
>If you are looking, then re-typing the code it might as well be copying
>code at which point I'd think it violates the ROM license if you're making
>your own source.

Oh my god, I've had to bite back sooo many biting retorts. So, I'll just
let the code speak for itself.  I'll let the list tell me if I have a ROM
derivative or not... (but really, honestly, I see no way that I can stop
it from being a ROM derivative if you call it one - there's only so many
ways to send data in a loop to someone!!)

Really though, of 926 lines of code (real code, non-blank or comment),
917 are completely unique. (Or... they better be!)

// Snip.
const char color_ident[16] = {
  'x', 'r', 'g', 'y', 'b', 'm', 'c', 'w', 'd',
  'R', 'G', 'Y', 'B', 'M', 'C', 'W'
};
const char * colors[16] = {
  "\e[0m", "\e[0;31m", "\e[0;32m", "\e0;33m",
  "\e[0;34m", "\e[0;35m", "\e[0;36m", "\e0;37m",
  "\e[1;30m", "\e[1;31m", "\e[1;32m", "\e[1;33m",
  "\e[1;34m", "\e[1;35m", "\e[1;36m", "\e[1;37m"
};
void telnet_server::write_to_descriptor(descriptor * d)
{
  if (serverdown)
    return;
  string str;
  char input[8192], txt[8192];
  int start, write, block, x, length;
  str=d->get_outbuf();
  if (str == "")
    return;
  *input=0;
  strcpy(input, str.c_str());
  length=strlen(input);
  *txt=0;
  for (start=block=0; start < length; start++)
  {
    if (input[start] == '{')
    {
      if (input[start+1] == color_ident[x])
      {
        strncat(txt, input+block, start-block);
        strcat(txt, colors[x]);
        block=start+2;
        break;
      }
    }
  }
  strncat(txt, input+block, start-block);
  x=d->get_socket();
  length=strlen(txt);
  for(start=0; start < length; start+=write)
  {
    block=(length-start < 4096)?length-start:4096;
    if ((write=send(x, txt+start, block, 0)) < 0)
    {
      perror("write_to_descriptor() failed");
      return;
    }
  }
}


// End snip

I will note, however, that your issue of whether or not it's a ROM derivative
is... utterly unimportant.  I posted to find out if I can enlist the aid
of someone with skill. Because I'm at my wit's end.. I cannot figure
out why once everyone logs out of the mud, and someone logs back in,
the mud crashes on the first command they type, and their pretitle is
mystically "You're all set!" and their name is my room description!!

Oh. Noteworthy: a clean compile didn't fix it... but I hadn't tried it.
Its much appreciated and will go on my list of "things to try before whining"

;-) Thanks Dale.

Mark
Esheliam

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d s: a-- C++>$ UL+ P+ L++ !E(---) W- N o? K? w 
O- M-- V-- PS+ PE-- Y+ !PGP !tv t+ 5? X? R* b+++ DI+ D- 
G++ e++> h---- r+++ y-- 
------END GEEK CODE BLOCK------





Reply via email to