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

Diff for /src/usr.bin/mail/fio.c between version 1.6 and 1.7

version 1.6, 1997/07/13 21:21:12 version 1.7, 1997/07/13 23:53:59
Line 84 
Line 84 
                 msgCount = 0;                  msgCount = 0;
         } else {          } else {
                 /* Seek into the file to get to the new messages */                  /* Seek into the file to get to the new messages */
                 (void) fseek(ibuf, offset, 0);                  (void)fseek(ibuf, offset, 0);
                 /*                  /*
                  * We need to make "offset" a pointer to the end of                   * We need to make "offset" a pointer to the end of
                  * the temp file that has the copy of the mail file.                   * the temp file that has the copy of the mail file.
                  * If any messages have been edited, this will be                   * If any messages have been edited, this will be
                  * different from the offset into the mail file.                   * different from the offset into the mail file.
                  */                   */
                 (void) fseek(otf, 0L, SEEK_END);                  (void)fseek(otf, 0L, SEEK_END);
                 offset = ftell(otf);                  offset = ftell(otf);
         }          }
         omsgCount = msgCount;          omsgCount = msgCount;
Line 110 
Line 110 
                         return;                          return;
                 }                  }
                 count = strlen(linebuf);                  count = strlen(linebuf);
                 (void) fwrite(linebuf, sizeof(*linebuf), count, otf);                  (void)fwrite(linebuf, sizeof(*linebuf), count, otf);
                 if (ferror(otf))                  if (ferror(otf))
                         err(1, "/tmp");                          err(1, "/tmp");
                 linebuf[count - 1] = '\0';                  linebuf[count - 1] = '\0';
Line 166 
Line 166 
         register int c;          register int c;
   
         c = strlen(linebuf);          c = strlen(linebuf);
         (void) fwrite(linebuf, sizeof(*linebuf), c, obuf);          (void)fwrite(linebuf, sizeof(*linebuf), c, obuf);
         if (outlf) {          if (outlf) {
                 (void) putc('\n', obuf);                  (void)putc('\n', obuf);
                 c++;                  c++;
         }          }
         if (ferror(obuf))          if (ferror(obuf))
Line 225 
Line 225 
         FILE *f;          FILE *f;
         int omsgCount;          int omsgCount;
 {  {
         register size = (msgCount + 1) * sizeof(struct message);          register size_t size = (msgCount + 1) * sizeof(struct message);
   
         if (omsgCount) {          if (omsgCount) {
                 message = (struct message *)realloc(message, (unsigned) size);                  message = (struct message *)realloc(message, size);
                 if (message == 0)                  if (message == 0)
                         panic("Insufficient memory for %d messages\n", msgCount);                          panic("Insufficient memory for %d messages\n", msgCount);
         } else {          } else {
                 if (message != 0)                  if (message != 0)
                         free((char *) message);                          (void)free(message);
                 if ((message = (struct message *) malloc((unsigned) size)) == 0)                  if ((message = (struct message *)malloc(size)) == 0)
                         panic("Insufficient memory for %d messages", msgCount);                          panic("Insufficient memory for %d messages", msgCount);
                 dot = message;                  dot = message;
         }          }
         size -= (omsgCount + 1) * sizeof(struct message);          size -= (omsgCount + 1) * sizeof(struct message);
         fflush(f);          fflush(f);
         (void) lseek(fileno(f), (off_t)sizeof(*message), 0);          (void)lseek(fileno(f), (off_t)sizeof(*message), 0);
         if (read(fileno(f), (void *) &message[omsgCount], size) != size)          if (read(fileno(f), (void *) &message[omsgCount], size) != size)
                 panic("Message temporary file corrupted");                  panic("Message temporary file corrupted");
         message[msgCount].m_size = 0;          message[msgCount].m_size = 0;
Line 455 
Line 455 
         else if (*cp != '/') {          else if (*cp != '/') {
                 char buf[PATHSIZE];                  char buf[PATHSIZE];
   
                 (void) snprintf(buf, sizeof(buf), "~/%s", cp);                  (void)snprintf(buf, sizeof(buf), "~/%s", cp);
                 cp = expand(buf);                  cp = expand(buf);
         }          }
         return(cp);          return(cp);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7