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

Diff for /src/usr.bin/mail/cmd1.c between version 1.19 and 1.20

version 1.19, 2001/11/16 17:10:06 version 1.20, 2001/11/20 20:50:00
Line 57 
Line 57 
  */   */
   
 static int screen;  static int screen;
   static volatile sig_atomic_t gothdrint;
   
 int  int
 headers(v)  headers(v)
Line 65 
Line 66 
         int *msgvec = v;          int *msgvec = v;
         int n, mesg, flag, size;          int n, mesg, flag, size;
         struct message *mp;          struct message *mp;
           struct sigaction act, oact;
           sigset_t oset;
   
         size = screensize();          size = screensize();
         n = msgvec[0];          n = msgvec[0];
Line 81 
Line 84 
         mesg = mp - &message[0];          mesg = mp - &message[0];
         if (dot != &message[n-1])          if (dot != &message[n-1])
                 dot = mp;                  dot = mp;
         for (; mp < &message[msgCount]; mp++) {          sigemptyset(&act.sa_mask);
           act.sa_flags = SA_RESTART;
           act.sa_handler = hdrint;
           if (sigaction(SIGINT, NULL, &oact) == 0 &&
               oact.sa_handler != SIG_IGN) {
                   (void)sigaction(SIGINT, &act, &oact);
                   (void)sigprocmask(SIG_UNBLOCK, &intset, &oset);
           }
           for (gothdrint = 0; !gothdrint && mp < &message[msgCount]; mp++) {
                 mesg++;                  mesg++;
                 if (mp->m_flag & MDELETED)                  if (mp->m_flag & MDELETED)
                         continue;                          continue;
Line 89 
Line 100 
                         break;                          break;
                 printhead(mesg);                  printhead(mesg);
         }          }
           if (gothdrint) {
                   fflush(stdout);
                   fputs("\nInterrupt\n", stderr);
           }
           if (oact.sa_handler != SIG_IGN) {
                   (void)sigprocmask(SIG_SETMASK, &oset, NULL);
                   (void)sigaction(SIGINT, &oact, NULL);
           }
         if (flag == 0) {          if (flag == 0) {
                 puts("No more mail.");                  puts("No more mail.");
                 return(1);                  return(1);
Line 186 
Line 205 
         char **ap;          char **ap;
   
         mp = &message[mesg-1];          mp = &message[mesg-1];
         (void)readline(setinput(mp), headline, LINESIZE);          (void)readline(setinput(mp), headline, LINESIZE, NULL);
         if ((subjline = hfield("subject", mp)) == NULL)          if ((subjline = hfield("subject", mp)) == NULL)
                 subjline = hfield("subj", mp);                  subjline = hfield("subj", mp);
         /*          /*
Line 344 
Line 363 
         int nlines, *ip, restoreterm;          int nlines, *ip, restoreterm;
         struct message *mp;          struct message *mp;
         struct termios tbuf;          struct termios tbuf;
         char * volatile cp;          char *cp;
         FILE * volatile obuf;          FILE *obuf;
   
         obuf = stdout;          obuf = stdout;
         restoreterm = 0;          restoreterm = 0;
Line 357 
Line 376 
                 restoreterm = (tcgetattr(fileno(stdin), &tbuf) == 0);                  restoreterm = (tcgetattr(fileno(stdin), &tbuf) == 0);
                 obuf = Popen(cmd, "w");                  obuf = Popen(cmd, "w");
                 if (obuf == NULL) {                  if (obuf == NULL) {
                         warn("%s", cp);                          warn("%s", cmd);
                         obuf = stdout;                          obuf = stdout;
                 } else {  
                         (void)signal(SIGPIPE, SIG_IGN);  
                 }                  }
         } else if (value("interactive") != NULL &&          } else if (value("interactive") != NULL &&
                  (page || (cp = value("crt")) != NULL)) {                   (page || (cp = value("crt")) != NULL)) {
Line 375 
Line 392 
                         if (obuf == NULL) {                          if (obuf == NULL) {
                                 warn("%s", cp);                                  warn("%s", cp);
                                 obuf = stdout;                                  obuf = stdout;
                         } else                          }
                                 (void)signal(SIGPIPE, SIG_IGN);  
                 }                  }
         }          }
   
Line 395 
Line 411 
   
         if (obuf != stdout) {          if (obuf != stdout) {
                 (void)Pclose(obuf);                  (void)Pclose(obuf);
                 (void)signal(SIGPIPE, SIG_DFL);  
                 if (restoreterm)                  if (restoreterm)
                         (void)tcsetattr(fileno(stdin), TCSADRAIN, &tbuf);                          (void)tcsetattr(fileno(stdin), TCSADRAIN, &tbuf);
         }          }
Line 437 
Line 452 
                 if (!lineb)                  if (!lineb)
                         putchar('\n');                          putchar('\n');
                 for (lines = 0; lines < c && lines <= topl; lines++) {                  for (lines = 0; lines < c && lines <= topl; lines++) {
                         if (readline(ibuf, linebuf, sizeof(linebuf)) < 0)                          if (readline(ibuf, linebuf, sizeof(linebuf), NULL) < 0)
                                 break;                                  break;
                         puts(linebuf);                          puts(linebuf);
                         lineb = blankline(linebuf);                          lineb = blankline(linebuf);
Line 527 
Line 542 
         }          }
   
         return(0);          return(0);
   }
   
   /*
    * User hit ^C while printing the headers.
    */
   void
   hdrint(s)
           int s;
   {
   
           gothdrint = 1;
 }  }

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20