nmh-workers
[Top] [All Lists]

patch to allow long sequences.

1995-04-23 12:02:02

hi,

this patch allows extremely long sequences to work.  i'm not sure
that the rellaoc() stuff is the "mh" way, but i couldn't find any
other code in a quick scan that does the same in the source.

.mrg.

*** m_gmsg.c.orig       Wed Dec  1 15:01:24 1993
--- m_gmsg.c    Sun Apr 23 18:29:20 1995
***************
*** 212,217 ****
--- 212,218 ----
      register char  *cp;
      char    name[NAMESZ],
              field[BUFSIZ * 2];
+     register char  *buf = NULL;
      register struct node   *np;
      register    FILE * fp;

***************
*** 229,237 ****
      if (fp = fopen (field, "r")) {
        for (state = FLD;;) {
            switch (state = m_getfld (state, name, field, sizeof field, fp)) {
                case FLD:
                case FLDEOF:
!                   (void) m_setatr (mp, getcpy (name), trimcpy (field));
                    if (state == FLDEOF)
                        break;
                    continue;
--- 230,252 ----
      if (fp = fopen (field, "r")) {
        for (state = FLD;;) {
            switch (state = m_getfld (state, name, field, sizeof field, fp)) {
+               case FLDPLUS:
                case FLD:
                case FLDEOF:
!                   if (buf) {
!                       buf = realloc (buf, strlen(buf) + strlen (name) + 1);
!                       if (buf == NULL)
!                           adios (NULLCP, "unable to allocate string storage");
!                       (void) strcat (buf, name);
!                   }
!                   else
!                       buf = getcpy (name);
!
!                   if (state != FLDPLUS) {
!                       (void) m_setatr (mp, buf, trimcpy (field));
!                       free (buf);
!                       buf = NULL;
!                   }
                    if (state == FLDEOF)
                        break;
                    continue;
***************
*** 251,256 ****
--- 266,273 ----
            }
            break;
        }
+       if (buf)
+           free (buf);
        (void) fclose (fp);
      }


<Prev in Thread] Current Thread [Next in Thread>
  • patch to allow long sequences., matthew green <=