]> diplodocus.org Git - nmh/blobdiff - sbr/seq_list.c
Add FIXME raising if iscntrl(3) test should be based on isprint(3)
[nmh] / sbr / seq_list.c
index ecc03bfd7123ed94fe060f43e850df4778ff58c6..aff9bacdf3ce2f3ecd39883770aa34c3f036a220 100644 (file)
@@ -3,8 +3,6 @@
  * seq_list.c -- Get all messages in a sequence and return them
  *            -- as a space separated list of message ranges.
  *
- * $Id$
- *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
  * complete copyright information.
@@ -41,10 +39,10 @@ seq_list(struct msgs *mp, char *seqname)
      */
     if (!strcmp (current, seqname)) {
        if (mp->curmsg) {       
-           sprintf(buffer, "%s", m_name(mp->curmsg));
+           snprintf(buffer, len, "%s", m_name(mp->curmsg));
            return (buffer);
-       } else
-           return (NULL);
+       }
+        return (NULL);
     }
 
     /* If the folder is empty, just return NULL */
@@ -75,8 +73,7 @@ seq_list(struct msgs *mp, char *seqname)
            char *newbuf;
 
            len += MAXBUFFER;
-           if (!(newbuf = realloc (buffer, (size_t) len)))
-               adios (NULL, "unable to realloc storage in seq_list");
+           newbuf = mh_xrealloc (buffer, (size_t) len);
            bp = newbuf + (bp - buffer);
            buffer = newbuf;
        }
@@ -88,7 +85,7 @@ seq_list(struct msgs *mp, char *seqname)
        if (bp > buffer)
            *bp++ = ' ';
 
-       sprintf(bp, "%s", m_name(i));
+       strcpy(bp, m_name(i));
        bp += strlen(bp);
        j = i;                  /* Remember beginning of message range */
 
@@ -100,7 +97,8 @@ seq_list(struct msgs *mp, char *seqname)
            ;
 
        if (i - j > 1) {
-           sprintf(bp, "-%s", m_name(i - 1));
+            *bp++ = '-';
+           strcpy(bp, m_name(i - 1));
            bp += strlen(bp);
        }
     }