[BACK]Return to cmd3.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mail

Diff for /src/usr.bin/mail/cmd3.c between version 1.17 and 1.18

version 1.17, 2001/11/21 15:26:39 version 1.18, 2001/11/21 20:41:55
Line 265 
Line 265 
 reedit(char *subj)  reedit(char *subj)
 {  {
         char *newsubj;          char *newsubj;
           size_t len;
   
         if (subj == NULL)          if (subj == NULL)
                 return(NULL);                  return(NULL);
Line 272 
Line 273 
             (subj[1] == 'e' || subj[1] == 'E') &&              (subj[1] == 'e' || subj[1] == 'E') &&
             subj[2] == ':')              subj[2] == ':')
                 return(subj);                  return(subj);
         newsubj = salloc(strlen(subj) + 5);          len = strlen(subj) + 5;
         strcpy(newsubj, "Re: ");          newsubj = salloc(len);
         strcpy(newsubj + 4, subj);          strlcpy(newsubj, "Re: ", len);
           strlcat(newsubj, subj, len);
         return(newsubj);          return(newsubj);
 }  }
   
Line 489 
Line 491 
         gname = *argv;          gname = *argv;
         h = hash(gname);          h = hash(gname);
         if ((gh = findgroup(gname)) == NULL) {          if ((gh = findgroup(gname)) == NULL) {
                 gh = (struct grouphead *)calloc(sizeof(*gh), 1);                  if ((gh = (struct grouphead *)calloc(sizeof(*gh), 1)) == NULL)
                           errx(1, "Out of memory");
                 gh->g_name = vcopy(gname);                  gh->g_name = vcopy(gname);
                 gh->g_list = NULL;                  gh->g_list = NULL;
                 gh->g_link = groups[h];                  gh->g_link = groups[h];
Line 503 
Line 506 
          */           */
   
         for (ap = argv+1; *ap != NULL; ap++) {          for (ap = argv+1; *ap != NULL; ap++) {
                 gp = (struct group *)calloc(sizeof(*gp), 1);                  if ((gp = (struct group *)calloc(sizeof(*gp), 1)) == NULL)
                           errx(1, "Out of memory");
                 gp->ge_name = vcopy(*ap);                  gp->ge_name = vcopy(*ap);
                 gp->ge_link = gh->g_list;                  gp->ge_link = gh->g_list;
                 gh->g_list = gp;                  gh->g_list = gp;
Line 719 
Line 723 
 alternates(void *v)  alternates(void *v)
 {  {
         char **namelist = v;          char **namelist = v;
         char **ap, **ap2, *cp;          char **ap, **ap2;
         int c;          int c;
   
         c = argcount(namelist) + 1;          c = argcount(namelist) + 1;
Line 733 
Line 737 
         }          }
         if (altnames != 0)          if (altnames != 0)
                 (void)free(altnames);                  (void)free(altnames);
         altnames = (char **)calloc(c, sizeof(char *));          if ((altnames = (char **)calloc(c, sizeof(char *))) == NULL)
                   errx(1, "Out of memory");
         for (ap = namelist, ap2 = altnames; *ap; ap++, ap2++) {          for (ap = namelist, ap2 = altnames; *ap; ap++, ap2++) {
                 cp = (char *)calloc(strlen(*ap) + 1, sizeof(char));                  if ((*ap2 = strdup(*ap)) == NULL)
                 strcpy(cp, *ap);                          errx(1, "Out of memory");
                 *ap2 = cp;  
         }          }
         *ap2 = 0;          *ap2 = 0;
         return(0);          return(0);

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18