Re: Stock bug?

From: George Greer (greerga@circlemud.org)
Date: 12/14/99


On Wed, 8 Dec 1999, Del wrote:

>The only bug I see is the \r\n was lost at the end of the description when
>looking at one's self.

How about this? (compiled, not run)

Index: modify.c

RCS file: /home/circledb/.cvs/circle/src/modify.c,v
retrieving revision 1.21
diff -u -p -r1.21 modify.c
--- modify.c    1999/07/05 03:41:12     1.21
+++ modify.c    1999/12/14 18:19:44
@@ -121,11 +121,14 @@ void string_add(struct descriptor_data *
   if (!(*d->str)) {
     if (strlen(str) + 3 > d->max_str) { /* \r\n\0 */
       send_to_char("String too long - Truncated.\r\n", d->character);
-      str[d->max_str] = '\0';
+      strcpy(&str[d->max_str - 3], "\r\n");
+      CREATE(*d->str, char, d->max_str);
+      strcpy(*d->str, str);
       terminator = 1;
+    } else {
+      CREATE(*d->str, char, strlen(str) + 3);
+      strcpy(*d->str, str);
     }
-    CREATE(*d->str, char, strlen(str) + 3);
-    strcpy(*d->str, str);
   } else {
     if (strlen(str) + strlen(*d->str) + 3 > d->max_str) { /* \r\n\0 */
       send_to_char("String too long.  Last line skipped.\r\n", d->character);

Exam week, be glad I had a 7:30 AM and will have a 5:30 PM or I wouldn't
have the time.

--
George Greer            | Code from Erwin S. Andreasen (mudFTP, mcl)
greerga@circlemud.org   | http://www.andreasen.org/


     +------------------------------------------------------------+
     | 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