]> git.pond.sub.org Git - empserver/commitdiff
(rea, turn): Use a different buffer for message text. Just for
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 12 Jun 2005 10:11:04 +0000 (10:11 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 12 Jun 2005 10:11:04 +0000 (10:11 +0000)
clarity.

src/lib/commands/rea.c
src/lib/commands/turn.c

index 047d614a7d371c4eabf24c6842f61db112ba0093..ccf405c357ac3e4473602e372754ec3af70c9f71 100644 (file)
@@ -63,7 +63,8 @@ rea(void)
     int teles;
     int size;
     unsigned int nbytes;
-    s_char buf[4096]; /* buf is message text */
+    char buf[1024];
+    char msgbuf[4096];         /* message text */
     int lasttype;
     int lastcnum;
     time_t lastdate;
@@ -163,12 +164,12 @@ rea(void)
       skip:
        while (tgm.tel_length > 0) {
            nbytes = tgm.tel_length;
-           if (nbytes > sizeof(buf) - 1)
-               nbytes = sizeof(buf) - 1;
-           (void)fread(buf, sizeof(s_char), nbytes, telfp);
-           buf[nbytes] = 0;
+           if (nbytes > sizeof(msgbuf) - 1)
+               nbytes = sizeof(msgbuf) - 1;
+           (void)fread(msgbuf, sizeof(s_char), nbytes, telfp);
+           msgbuf[nbytes] = 0;
            if (readit)
-               uprnf(buf);
+               uprnf(msgbuf);
            tgm.tel_length -= nbytes;
        }
     }
index 041d1f97be44f30ef65d5af04965cf5bccc68c81..d55228aae1fddfe79308ed9f8301c97d5651938b 100644 (file)
@@ -49,7 +49,8 @@ turn(void)
     FILE *fptr;
     struct telstr tgm;
     char *p;
-    char buf[MAXTELSIZE + 1];
+    char buf[1024];
+    char msgbuf[MAXTELSIZE + 1]; /* message text */
     char *msgfilepath;
 
     p = getstarg(player->argp[1], "on, off or motd? ", buf);
@@ -75,7 +76,7 @@ turn(void)
        pr("Enter a new message of the day.\n");
 
     time(&tgm.tel_date);
-    tgm.tel_length = getele("The World", buf);
+    tgm.tel_length = getele("The World", msgbuf);
 
     if (tgm.tel_length < 0) {
        pr("Ignored\n");
@@ -106,7 +107,7 @@ turn(void)
        pr("Logins disabled.\n");
 
     if ((fwrite(&tgm, sizeof(tgm), 1, fptr) != 1) ||
-       (fwrite(buf, tgm.tel_length, 1, fptr) != 1)) {
+       (fwrite(msgbuf, tgm.tel_length, 1, fptr) != 1)) {
        fclose(fptr);
        pr("Something went wrong writing the message file.\n");
        logerror("Could not properly write message file (%s).\n",