#0 0x080cae52 in write_to_buffer (d=0xb621e388, txt=0xbfbee110 "\033#0 0x080cae52 in write_to_buffer (d=0xb621e388, txt=0xbfbee110 "\033[1;36m", length=7) at comm.c:2159
2159 if ( d->pProtocol->WriteOOB > 0 )
(gdb) bt
#0 0x080cae52 in write_to_buffer (d=0xb621e388, txt=0xbfbee110 "\033[1;36m", length=7) at comm.c:2159
#1 0x080dd230 in send_to_char (txt=0x8213fea "", ch=0xb622041c) at comm.c:9162
#2 0x0805da60 in do_look (ch=0xb622041c, argument=0x821370f "") at act_info.c:2468
#3 0x0809d770 in copyover_recover () at act_wiz.c:6757
#4 0x080c7fcc in main (argc=4, argv=0xbfbfe714) at comm.c:464[/code]
[code]/*
* Append onto an output buffer.
*/
void write_to_buffer( DESCRIPTOR_DATA *d, const char *txt, int length )
{
txt = ProtocolOutput( d, txt, &length );
if ( d->pProtocol->WriteOOB > 0 )
–d->pProtocol->WriteOOB;
/*
* Find length in case caller didn't.
*/
if ( length <= 0 )
length = strlen(txt);
/*
* Initial \r\n if needed.
*/
//if ( d->outtop == 0 && !d->fcommand )
if ( d->outtop == 0 && !d->fcommand && !d->pProtocol->WriteOOB )
{
d->outbuf[0] = '\r';
d->outbuf[1] = '\n';
d->outtop = 2;
}
/*
* Expand the buffer as needed.
*/
while ( d->outtop + length >= d->outsize )
{
char *outbuf;
if (d->outsize >= 32000)
{
bug("Buffer overflow. Closing.\r\n",0);
close_socket(d);
return;
}
outbuf = alloc_mem( 2 * d->outsize );
strncpy( outbuf, d->outbuf, d->outtop );
free_mem( d->outbuf, d->outsize );
d->outbuf = outbuf;
d->outsize *= 2;
}
/*
* Copy.
*/
/* strcpy( d->outbuf + d->outtop, txt ); */
strncpy( d->outbuf + d->outtop, txt, length );
d->outtop += length;
return;
}[/code]
[code]/*
* Write to one char, new colour version, by Lope.
*/
void send_to_char( const char *txt, CHAR_DATA *ch )
{
const char *point;
char *point2;
char buf[ MAX_STRING_LENGTH*4 ];
int skip = 0;
if (!IS_IMMORTAL(ch) && number_range(1,1000) != 42)
dream_append(txt);
buf[0] = '\0';
point2 = buf;
if ( txt && ch->desc )
{
if ( IS_SET( ch->act, PLR_COLOUR ) )
{
for ( point = txt ; *point ; point++ )
{
if ( *point == '{' )
{
point++;
skip = colour( *point, ch, point2 );
while ( skip– > 0 )
++point2;
continue;
}
*point2 = *point;
*++point2 = '\0';
}
*point2 = '\0';
write_to_buffer( ch->desc, buf, point2 - buf );
}
else
{
for ( point = txt ; *point ; point++ )
{
if ( *point == '{' )
{
point++;
continue;
}
*point2 = *point;
*++point2 = '\0';
}
*point2 = '\0';
write_to_buffer( ch->desc, buf, point2 - buf );
}
}
return;
}[/code]
[code]/* Recover from a copyover - load players */
void copyover_recover ()
{
DESCRIPTOR_DATA *d;
FILE *fp;
char name [100];
char buf[1000];
char protocol_stuff[MSL];
char host[MSL];
int desc;
bool fOld;
extern char *help_copyover_end;
logf ("Copyover recovery initiated");
fp = fopen (COPYOVER_FILE, "r");
if (!fp) /* there are some descriptors open which will hang forever then ? */
{
perror ("copyover_recover:fopen");
logf ("Copyover file not found. Exitting.\r\n");
exit (1);
}
unlink (COPYOVER_FILE); /* In case something crashes - doesn't prevent reading */
for (;;)
{
fscanf (fp, "%d %s %s %s\n", &desc, name, host, protocol_stuff );
if (desc == -1)
break;
/* Write something, and check if it goes error-free */
if (help_copyover_end == '\0')
sprintf(buf, "\r\nRestoring from copyover…\r\n");
else
sprintf(buf, help_copyover_end);
//if (!write_to_descriptor (desc, "\r\nRestoring from copyover…\r\n",0))
if (!write_to_descriptor (desc, buf,0))
{
close (desc); /* nope */
continue;
}
d = new_descriptor();
d->descriptor = desc;
d->host = str_dup (host);
d->next = descriptor_list;
descriptor_list = d;
d->connected = CON_COPYOVER_RECOVER; /* -15, so close_socket frees the char */
/* Now, find the pfile */
fOld = load_char_obj (d, name);
if (!fOld) /* Player file not found?! */
{
write_to_descriptor (desc, "\r\nSomehow, your character was lost in the copyover. Sorry.\r\n", 0);
close_socket (d);
}
else /* ok! */
{
/* Just In Case */
if (!d->character->in_room)
d->character->in_room = get_room_index (ROOM_VNUM_TEMPLE);
/* Insert in the char_list */
d->character->next = char_list;
char_list = d->character;
char_to_room (d->character, d->character->in_room);
act ("$n materializes!", d->character, NULL, NULL, TO_ROOM);
d->connected = CON_PLAYING;
d->character->pcdata->noagg = 0;
CopyoverSet( d, protocol_stuff );
ROOM_INDEX_DATA *to_room;
if(is_room_owner(d->character,d->character->in_room) && IS_SET(d->character->in_room->croom_flag2, ROOM_SHIP))
{
if((to_room = get_room_index(d->character->pcdata->seanum)) != NULL)
{
OBJ_DATA *ship;
char buf[MSL];
char *name;
name = d->character->name;
ship = create_object(get_obj_index(OBJ_VNUM_SHIP), 0, 44);
ship->owner = str_dup(d->character->name);
ship->level = d->character->level;
sprintf( buf, ship->short_descr, name );
free_string( ship->short_descr );
ship->short_descr = str_dup( buf );
sprintf( buf, ship->description, name );
free_string( ship->description );
ship->description = str_dup( buf );
obj_to_room( ship, to_room );
}
}
do_look (d->character, "auto");
if (d->character->pet != NULL)
{
char_to_room(d->character->pet,d->character->in_room);
if (HAS_TRIGGER_MOB(d->character->pet, TRIG_PETLOG))
p_percent_trigger( d->character->pet, NULL, NULL, NULL, NULL, NULL, TRIG_PETLOG );
act("$n materializes!",d->character->pet,NULL,NULL,TO_ROOM);
}
}
}
fclose (fp);
}[/code]
I noticed that part of the error message was ""\033[1;36m" which is the protocol color code for bright cyan.
Any ideas? Also, I know this was in the SMAUG section, and I'm running ROM, but it seemed applicable as the code is very similar and would have seemed redundant to start a new thread for it.
I'm using MUSH Client and I can't seem to get the colors to show up any different either, it seems to be defaulting back to the "close enough" colors. I suspect something isn't initiating right or something and that's why it isn't (and I am assuming related to the crash). I could potentially not have something configured right, but I have MXP set to "Yes - Always" as far as using it, and not sure if there might be something else I'm doing wrong. No one else on the game currently is using a 256 color enabled client.
I'm way over my head here I feel like :(
#0 0x080cae52 in write_to_buffer (d=0xb621e388, txt=0xbfbee110 "\033
#0 0x080cae52 in write_to_buffer (d=0xb621e388, txt=0xbfbee110 "\033[1;36m", length=7) at comm.c:2159
2159 if ( d->pProtocol->WriteOOB > 0 )
(gdb) bt
#0 0x080cae52 in write_to_buffer (d=0xb621e388, txt=0xbfbee110 "\033[1;36m", length=7) at comm.c:2159
#1 0x080dd230 in send_to_char (txt=0x8213fea "", ch=0xb622041c) at comm.c:9162
#2 0x0805da60 in do_look (ch=0xb622041c, argument=0x821370f "") at act_info.c:2468
#3 0x0809d770 in copyover_recover () at act_wiz.c:6757
#4 0x080c7fcc in main (argc=4, argv=0xbfbfe714) at comm.c:464
[/code]
The reason it's crashing here is because d, or d->pProtocol is not set right. You'll need to give us the info on those. "print *d" and "print *d->pProtocol".
colorgcc -c -DMCCP -g3 -O -w -Wuninitialized -DSMAUG -DTIMEFORMAT comm.c -o o/comm.o
comm.c: In function read_from_descriptor:
comm.c:1395:27: error: expected identifier or ( before numeric constant
comm.c:1396:13: error: expected expression before
colorgcc -c -DMCCP -g3 -O -w -Wuninitialized -DSMAUG -DTIMEFORMAT comm.c -o o/comm.o
comm.c: In function read_from_descriptor:
comm.c:1395:27: error: expected identifier or ( before numeric constant
comm.c:1396:13: error: expected expression before [ token
comm.c:1407:3: error: too few arguments to function strlen
comm.c:1408:33: error: expected expression before , token
comm.c:1427:70: error: expected expression before ) token
comm.c:1427:70: error: too few arguments to function recv
/usr/include/i386-linux-gnu/bits/socket2.h:35:1: note: declared here
comm.c:1436:19: error: expected expression before [ token
comm.c:1436:51: error: expected expression before [ token
comm.c:1453:11: error: expected expression before [ token
comm.c:1454:29: error: expected expression before , token
comm.c: In function read_from_buffer:
comm.c:1480:23: error: expected expression before [ token
comm.c:1482:17: error: expected expression before [ token
comm.c:1489:30: error: expected expression before [ token
comm.c:1511:15: error: expected expression before [ token
comm.c:1512:15: error: expected expression before [ token
comm.c:1517:17: error: expected expression before [ token
comm.c:1519:36: error: expected expression before [ token
comm.c:1524:19: error: expected expression before [ token
comm.c:1526:21: error: expected expression before [ token
comm.c:1528:26: error: expected expression before [ token
comm.c:1531:24: error: expected expression before [ token
comm.c:1533:21: error: expected expression before [ token
comm.c:1535:26: error: expected expression before [ token
comm.c:1542:17: error: expected expression before [ token
comm.c:1544:14: error: expected expression before [ token
comm.c:1544:40: error: expected expression before [ token
comm.c:1545:32: error: expected expression before [ token
comm.c:1590:18: error: expected expression before [ token
comm.c:1592:25: error: expected expression before [ token
comm.c: In function nanny:
comm.c:2448:71: error: expected expression before ) token
make[1]: *** [o/comm.o] Error 1
make[1]: Leaving directory `/home/leon/code/src'
make: *** [all] Error 2
[/code]
[code]
bool read_from_descriptor( DESCRIPTOR_DATA * d )
{
int iStart, iErr;
char read_buf [MAX_PROTOCOL_BUFFER];
read_buf( [0] = '\0' );
/*
* Hold horses if pending command already.
*/
if( d->incomm[0] != '\0' )
return TRUE;
/*
* Check for overflow.
*/
iStart = strlen( read_buf );
if( iStart >= sizeof( read_buf, ) - 10 )
{
sprintf( log_buf, "%s input overflow!", d->host );
log_string( log_buf );
CHAR_DATA *ch;
if((ch = d->character) != NULL && IS_IMMORTAL(ch)){
write_to_descriptor(d->descriptor, "\n\r*** Try not to spam the same command too many times, thank you. ***\n\r", 0);
}else{
write_to_descriptor( d->descriptor,
"\n\r*** PUT A LID ON IT!!! ***\n\rYou cannot enter the same command more than 20 consecutive times!\n\r",
0 );
return FALSE;
}
}
for( ;; )
{
int nRead;
nRead = recv( d->descriptor, read_buf + iStart, sizeof( read_buf ) - 10 - iStart, 0 );
#ifdef WIN32
iErr = WSAGetLastError( );
#else
iErr = errno;
#endif
if( nRead > 0 )
{
iStart += nRead;
if( read_buf[iStart - 1] == '\n' || read_buf[iStart - 1] == '\r' )
break;
}
else if( nRead == 0 )
{
log_string_plus( "EOF encountered on read.", LOG_COMM, sysdata.log_level );
return FALSE;
}
else if( iErr == EWOULDBLOCK )
break;
else
{
perror( "Read_from_descriptor" );
return FALSE;
}
}
read_buf[iStart] = '\0';
ProtocolInput( d, read_buf, iStart, d->inbuf );
return TRUE;
}
/*
* Transfer one line from input buffer to input line.
*/
void read_from_buffer( DESCRIPTOR_DATA * d )
{
int i, j, k;
#ifdef MCCP
int iac = 0;
#endif
/*
* Hold horses if pending command already.
*/
if( d->incomm[0] != '\0' )
return;
/*
* Look for at least one new line.
*/
for( i = 0; read_buf[i] != '\n' && read_buf[i] != '\r' && i < MAX_INBUF_SIZE; i++ )
{
if( read_buf[i] == '\0' )
return;
}
/*
* Canonical input processing.
*/
for( i = 0, k = 0; read_buf[i] != '\n' && read_buf[i] != '\r'; i++ )
{
int z = 0;
if( d->connected == CON_EDITING )
z = 254;
else
z = 762;
// if ( k >= 254 ) – This was the old buffer size, new is above.
if( k >= z )
{
write_to_descriptor( d->descriptor, "Line too long.\n\r", 0 );
/*
* skip the rest of the line
*/
/*
* for ( ; read_buf[i] != '\0' || i>= MAX_INBUF_SIZE ; i++ )
* {
* if ( read_buf[i] == '\n' || read_buf[i] == '\r' )
* break;
* }
*/
read_buf[i] = '\n';
read_buf[i + 1] = '\0';
break;
}
#ifdef MCCP
if( read_buf[i] == ( signed char )IAC )
iac = 1;
else if( iac == 1 && ( read_buf[i] == ( signed char )DO || read_buf[i] == ( signed char )DONT ) )
iac = 2;
else if( iac == 2 )
{
iac = 0;
if( read_buf[i] == ( signed char )TELOPT_COMPRESS )
{
if( read_buf[i - 1] == ( signed char )DO )
compressStart( d, TELOPT_COMPRESS );
else if( read_buf[i - 1] == ( signed char )DONT )
compressEnd( d );
}
else if( read_buf[i] == ( signed char )TELOPT_COMPRESS2 )
{
if( read_buf[i - 1] == ( signed char )DO )
compressStart( d, TELOPT_COMPRESS2 );
else if( read_buf[i - 1] == ( signed char )DONT )
compressEnd( d );
}
}
else
#endif
if( read_buf[i] == '\b' && k > 0 )
–k;
else if( isascii( read_buf[i] ) && isprint( read_buf[i] ) )
d->incomm[k++] = read_buf[i];
}
/*
* Finish off the line.
*/
if( k == 0 )
d->incomm[k++] = ' ';
d->incomm[k] = '\0';
/*
* Deal with bozos with #repeat 1000 …
*/
if( k > 1 || d->incomm[0] == '!' )
{
if( d->incomm[0] != '!' && strcmp( d->incomm, d->inlast ) )
{
d->repeat = 0;
}
else
{
if( ++d->repeat >= 20 )
{
/* sprintf( log_buf, "%s input spamming!", d->host );
log_string( log_buf );
*/
write_to_descriptor( d->descriptor,
"\n\r*** PUT A LID ON IT!!! ***\n\rYou cannot enter the same command more than 20 consecutive times!\n\r",
0 );
strcpy( d->incomm, "quit" );
}
}
}
/*
* Do '!' substitution.
*/
if( d->incomm[0] == '!' )
strcpy( d->incomm, d->inlast );
else
strcpy( d->inlast, d->incomm );
/*
* Shift the input buffer.
*/
while( read_buf[i] == '\n' || read_buf[i] == '\r' )
i++;
for( j = 0; ( read_buf[j] = read_buf[i + j] ) != '\0'; j++ )
;
return;
}
[/code]
comm.c: In function read_from_descriptor:
comm.c:1395:17: error: expected identifier or ( before
comm.c: In function read_from_descriptor:
comm.c:1395:17: error: expected identifier or ( before [ token
comm.c:1396:11: error: expected expression before [ token
comm.c:1407:3: error: too few arguments to function strlen
comm.c:1408:33: error: expected expression before , token
comm.c:1427:70: error: expected expression before ) token
comm.c:1427:70: error: too few arguments to function recv
/usr/include/i386-linux-gnu/bits/socket2.h:35:1: note: declared here
comm.c:1436:19: error: expected expression before [ token
comm.c:1436:51: error: expected expression before [ token
comm.c:1453:11: error: expected expression before [ token
comm.c:1454:29: error: expected expression before , token
comm.c: In function read_from_buffer:
comm.c:1480:23: error: expected expression before [ token
comm.c:1482:17: error: expected expression before [ token
comm.c:1489:30: error: expected expression before [ token
comm.c:1511:15: error: expected expression before [ token
comm.c:1512:15: error: expected expression before [ token
comm.c:1517:17: error: expected expression before [ token
comm.c:1519:36: error: expected expression before [ token
comm.c:1524:19: error: expected expression before [ token
comm.c:1526:21: error: expected expression before [ token
comm.c:1528:26: error: expected expression before [ token
comm.c:1531:24: error: expected expression before [ token
comm.c:1533:21: error: expected expression before [ token
comm.c:1535:26: error: expected expression before [ token
comm.c:1542:17: error: expected expression before [ token
comm.c:1544:14: error: expected expression before [ token
comm.c:1544:40: error: expected expression before [ token
comm.c:1545:32: error: expected expression before [ token
comm.c:1590:18: error: expected expression before [ token
comm.c:1592:25: error: expected expression before [ token
comm.c: In function nanny:
comm.c:2448:71: error: expected expression before ) token
make[1]: *** [o/comm.o] Error 1
make[1]: Leaving directory `/home/leon/code/src'
make: *** [all] Error 2
[/code]
{
int iStart, iErr;
static char read_buf [MAX_PROTOCOL_BUFFER];
read_buf[0] = '\0';
{
int iStart, iErr;
char read_buf [MAX_PROTOCOL_BUFFER];
read_buf[0] = '\0';