new_p->sender = p->sender;
new_p->date = p->date;
new_p->date_stamp = p->date_stamp;
new_p->expire = p->expire;
new_p->to_list = p->to_list;
new_p->subject = p->subject;
new_p->text = p->text;
new_p->status = atoi(arg2);
unlink_note (ch->pcdata->board,p);
free_global_note (p);
sprintf( log_buf, "%s changed status of gnote; author was %s and subject was: %s", ch->name, p->sender, p->subject );
log_string( log_buf );
p->status = atoi(arg2);
save_board(ch->pcdata->board); /* save the board */
if (ch->pcdata->board->note_first) /* are there any notes in there now? */
{
for (x = ch->pcdata->board->note_first; x->next; x = x->next )
; /* empty */
x->next = p;
}
else /* nope. empty list. */
ch->pcdata->board->note_first = p;
sprintf (filename, "%s%s", NOTE_DIR, ch->pcdata->board->short_name);
fp = fopen (filename, "a");
if (!fp)
{
bug ("Could not open one of the note files in append mode",0);
ch->pcdata->board->changed = TRUE; /* set it to TRUE hope it will be OK later? */
return;
}
append_note (fp, p);
fclose (fp);
unlink_note (ch->pcdata->board,p);
free_global_note (p);
send_to_char_color ("Gnote status changed!\n\r",ch);
strcat(new_p->text, buf);
strcat(new_p->text, STRALLOC(buf));
char tempbuf[MAX_STRING_LENGTH];
snprintf(tempbuf, MAX_STRING_LENGTH, "%s", new_p->text);
strncat(tempbuf, buf, MAX_STRING_LENGTH);
STRFREE(new_p->text);
new_p->text = STRALLOC(tempbuf);
ch->desc->connected = CON_NOTE_TEXT;
if (ch->substate == SUB_NONE)
{
ch->substate = SUB_APPEND_GNOTE;
ch->dest_buf = ch;
start_editing( ch, ch->pcdata->in_progress->text );
//handle_con_note_text(ch->desc, NULL);
}
snprintf(tempbuf, MAX_STRING_LENGTH, "%s", new_p->text);
strncat(tempbuf, copy_buffer(ch), MAX_STRING_LENGTH);
new_p->text = STRALLOC(tempbuf);
ch->desc->connected = CON_NOTE_TEXT;
if (ch->substate == SUB_NONE)
{
ch->substate = SUB_APPEND_GNOTE;
ch->dest_buf = ch;
start_editing( ch, ch->pcdata->in_progress->text );
//handle_con_note_text(ch->desc, NULL);
}
snprintf(tempbuf, MAX_STRING_LENGTH, "%s", new_p->text);
strncat(tempbuf, copy_buffer(ch), MAX_STRING_LENGTH);
new_p->text = STRALLOC(tempbuf);
switch ( ch->substate )
{
default:
break;
case SUB_ABORT:
send_to_char("&RAborted note apending!\r\n", ch );
return;
case SUB_APPEND_GNOTE:
char *cbuf;
cbuf = copy_buffer(ch);
snprintf(tempbuf, MAX_STRING_LENGTH, "%s", new_p->text );
strncat(tempbuf, cbuf, MAX_STRING_LENGTH );
STRFREE( new_p->text);
new_p->text = STRALLOC(tempbuf);
stop_editing( ch );
STRFREE(cbuf);
send_to_char("Note board has been appended\r\n", ch );
return;
}
ch->substate == SUB_APPENT_GNOTE;
//before you call start_editing make sure you point the in_progress to note board
start_editing( ch, ch->pcdata->in_progress->text );
board.c:1853: error: expected expression before 'char'
char *cbuf;
Date: Thu Aug 2 09:27:17 2007
To: imm
Status: 2
===========================================================================
Testinga
Then it changes.
Date: smile $n
break
endif
endif
To: imm
Status: 1
===========================================================================
Testinga
I did something wrong, apparently. Here is the code:
Any idea what I did wrong? The actual data written to file is not changed.
I have a feeling I should be using STRALLOC or str_dup when copying the struct?