Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Messages patch.
- To: crossfire (at) ifi.uio.no
- Subject: Messages patch.
- From: Skud the Great <>
- Date: Sun, 10 Jan 93 1:02:15 PST
Hello, finally got around to getting the message patch to the news
group.
However, im afraid, i dont know how to use diff to well, so i will
just list the routine below.
This patch below replaces the "put_message" routine in edit.c
just take out the old put_message and replace it with the new one.
It eliminates the numerous blank lines of text being stored after the actual
message.
----------------------------cut here------------------------------------------
void put_message(object *tmp, int line, char *text){
int i;
char *cp, *tmp2 = (char *) calloc(sizeof(char),VERY_BIG_BUF);
if(message[line-7]!=NULL)
free(message[line-7]);
message[line-7]=strdup(strcat(text,"\n"));
if(tmp->msg!=NULL) {
free_string(tmp->msg);
tmp->msg=NULL;
}
for (i=0; i<line-7;i++) {
if(message[i]==NULL)
strcat(tmp2,"\n");
else
strcat(tmp2,message[i]);
}
for (i=line-7; i<20;i++)
if (message[i]!=NULL)
strcat(tmp2,message[i]);
for(cp=tmp2+strlen(tmp2)-1;cp>=tmp2&&*tmp2=='\n';cp++)
cp='\0'; /* Clear trailing lineshifts */
tmp->msg=add_string(tmp2);
free(tmp2);
}