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

Diff for /src/usr.bin/mail/lex.c between version 1.24 and 1.25

version 1.24, 2001/11/17 19:10:25 version 1.25, 2001/11/20 20:50:00
Line 209 
Line 209 
   
   
 int     *msgvec;  int     *msgvec;
 int     reset_on_stop;                  /* do a reset() if stopped */  int     reset_on_stop;                  /* reset prompt if stopped */
   
 /*  /*
  * Interpret user commands one by one.  If standard input is not a tty,   * Interpret user commands one by one.  If standard input is not a tty,
Line 218 
Line 218 
 void  void
 commands()  commands()
 {  {
         int n;          int n, sig, *sigp;
         volatile int eofloop = 0;          int eofloop = 0;
         char linebuf[LINESIZE];          char linebuf[LINESIZE];
   
         if (!sourcing) {          prompt:
                 if (signal(SIGINT, SIG_IGN) != SIG_IGN)  
                         (void)signal(SIGINT, intr);  
                 if (signal(SIGHUP, SIG_IGN) != SIG_IGN)  
                         (void)signal(SIGHUP, hangup);  
                 (void)signal(SIGTSTP, stop);  
                 (void)signal(SIGTTOU, stop);  
                 (void)signal(SIGTTIN, stop);  
         }  
         setexit();  
         for (;;) {          for (;;) {
                 /*                  /*
                  * Print the prompt, if needed.  Clear out                   * Print the prompt, if needed.  Clear out
Line 250 
Line 241 
                  * and handle end of file specially.                   * and handle end of file specially.
                  */                   */
                 n = 0;                  n = 0;
                   sig = 0;
                   sigp = sourcing ? NULL : &sig;
                 for (;;) {                  for (;;) {
                         if (readline(input, &linebuf[n], LINESIZE - n) < 0) {                          if (readline(input, &linebuf[n], LINESIZE - n, sigp) < 0) {
                                   if (sig) {
                                           if (sig == SIGINT)
                                                   dointr();
                                           else if (sig == SIGHUP)
                                                   /* nothing to do? */
                                                   exit(1);
                                           else {
                                                   /* Stopped by job control */
                                                   (void)kill(0, sig);
                                                   if (reset_on_stop)
                                                           reset_on_stop = 0;
                                           }
                                           goto prompt;
                                   }
                                 if (n == 0)                                  if (n == 0)
                                         n = -1;                                          n = -1;
                                 break;                                  break;
Line 597 
Line 604 
   
 int     inithdr;                        /* am printing startup headers */  int     inithdr;                        /* am printing startup headers */
   
 /*ARGSUSED*/  
 void  void
 intr(s)  dointr()
         int s;  
 {  {
   
         noreset = 0;          noreset = 0;
Line 617 
Line 622 
                 image = -1;                  image = -1;
         }          }
         fputs("Interrupt\n", stderr);          fputs("Interrupt\n", stderr);
         reset(0);  
 }  
   
 /*  
  * When we wake up after ^Z, reprint the prompt.  
  */  
 void  
 stop(s)  
         int s;  
 {  
         sig_t old_action = signal(s, SIG_DFL);  
         sigset_t nset;  
   
         (void)sigemptyset(&nset);  
         (void)sigaddset(&nset, s);  
         (void)sigprocmask(SIG_UNBLOCK, &nset, NULL);  
         (void)kill(0, s);  
         (void)sigprocmask(SIG_BLOCK, &nset, NULL);  
         (void)signal(s, old_action);  
         if (reset_on_stop) {  
                 reset_on_stop = 0;  
                 reset(0);  
         }  
 }  
   
 /*  
  * Branch here on hangup signal and simulate "exit".  
  */  
 /*ARGSUSED*/  
 void  
 hangup(s)  
         int s;  
 {  
   
         /* nothing to do? */  
         exit(1);  
 }  }
   
 /*  /*

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25