[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.13 and 1.14

version 1.13, 1997/09/04 20:44:04 version 1.14, 1997/11/14 00:23:47
Line 62 
Line 62 
  */   */
 void  void
 setptr(ibuf, offset)  setptr(ibuf, offset)
         register FILE *ibuf;          FILE *ibuf;
         off_t offset;          off_t offset;
 {  {
         register int c, count;          int c, count;
         register char *cp, *cp2;          char *cp, *cp2;
         struct message this;          struct message this;
         FILE *mestmp;          FILE *mestmp;
         int maybe, inhead;          int maybe, inhead, omsgCount;
         char linebuf[LINESIZE], pathbuf[PATHSIZE];          char linebuf[LINESIZE], pathbuf[PATHSIZE];
         int omsgCount;  
   
         /* Get temporary file. */          /* Get temporary file. */
         (void)snprintf(pathbuf, sizeof(pathbuf), "%s/mail.XXXXXXXXXX", tmpdir);          (void)snprintf(pathbuf, sizeof(pathbuf), "%s/mail.XXXXXXXXXX", tmpdir);
Line 171 
Line 170 
         char *linebuf;          char *linebuf;
         int   outlf;          int   outlf;
 {  {
         register int c;          int c;
   
         c = strlen(linebuf);          c = strlen(linebuf);
         (void)fwrite(linebuf, sizeof(*linebuf), c, obuf);          (void)fwrite(linebuf, sizeof(*linebuf), c, obuf);
Line 195 
Line 194 
         char *linebuf;          char *linebuf;
         int linesize;          int linesize;
 {  {
         register int n;          int n;
   
         clearerr(ibuf);          clearerr(ibuf);
         if (fgets(linebuf, linesize, ibuf) == NULL)          if (fgets(linebuf, linesize, ibuf) == NULL)
Line 215 
Line 214 
  */   */
 FILE *  FILE *
 setinput(mp)  setinput(mp)
         register struct message *mp;          struct message *mp;
 {  {
   
         fflush(otf);          fflush(otf);
         if (fseek(itf, (long)positionof(mp->m_block, mp->m_offset), 0) < 0) {          if (fseek(itf, (long)positionof(mp->m_block, mp->m_offset), 0) < 0)
                 warn("fseek");                  err(1, "fseek");
                 panic("temporary file seek");  
         }  
         return(itf);          return(itf);
 }  }
   
Line 235 
Line 232 
         FILE *f;          FILE *f;
         int omsgCount;          int omsgCount;
 {  {
         register size_t size = (msgCount + 1) * sizeof(struct message);          size_t size = (msgCount + 1) * sizeof(struct message);
   
         if (omsgCount) {          if (omsgCount) {
                 message = (struct message *)realloc(message, size);                  message = (struct message *)realloc(message, size);
                 if (message == 0)                  if (message == 0)
                         panic("Insufficient memory for %d messages\n", msgCount);                          errx(1, "Insufficient memory for %d messages\n",
                               msgCount);
         } else {          } else {
                 if (message != 0)                  if (message != 0)
                         (void)free(message);                          (void)free(message);
                 if ((message = (struct message *)malloc(size)) == NULL)                  if ((message = (struct message *)malloc(size)) == NULL)
                         panic("Insufficient memory for %d messages", msgCount);                          errx(1, "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");                  errx(1, "Message temporary file corrupted");
         message[msgCount].m_size = 0;          message[msgCount].m_size = 0;
         message[msgCount].m_lines = 0;          message[msgCount].m_lines = 0;
         (void)Fclose(f);          (void)Fclose(f);
Line 345 
Line 344 
  */   */
 char *  char *
 expand(name)  expand(name)
         register char *name;          char *name;
 {  {
         char xname[PATHSIZE];          char xname[PATHSIZE];
         char cmdbuf[PATHSIZE];          /* also used for file names */          char cmdbuf[PATHSIZE];          /* also used for file names */
         register int pid, l;          int pid, l;
         register char *cp, *shell;          char *cp, *shell;
         int pivec[2];          int pivec[2];
         struct stat sbuf;          struct stat sbuf;
         extern int wait_status;          extern int wait_status;
Line 459 
Line 458 
 char *  char *
 getdeadletter()  getdeadletter()
 {  {
         register char *cp;          char *cp;
   
         if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL)          if ((cp = value("DEAD")) == NULL || (cp = expand(cp)) == NULL)
                 cp = expand("~/dead.letter");                  cp = expand("~/dead.letter");

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14