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

Diff for /src/usr.bin/less/signal.c between version 1.4 and 1.5

version 1.4, 2003/04/13 18:26:26 version 1.5, 2003/06/07 03:35:19
Line 15 
Line 15 
  * A signal usually merely causes a bit to be set in the "signals" word.   * A signal usually merely causes a bit to be set in the "signals" word.
  * At some convenient time, the mainline code checks to see if any   * At some convenient time, the mainline code checks to see if any
  * signals need processing by calling psignal().   * signals need processing by calling psignal().
  * If we happen to be reading from a file [in iread()] at the time  
  * the signal is received, we call intread to interrupt the iread.  
  */   */
   
 #include "less.h"  #include "less.h"
Line 32 
Line 30 
 extern int lnloop;  extern int lnloop;
 extern int linenums;  extern int linenums;
 extern int wscroll;  extern int wscroll;
 extern int reading;  
   
 /*  /*
  * Interrupt signal handler.   * Interrupt signal handler.
Line 45 
Line 42 
 #if OS2  #if OS2
         LSIGNAL(SIGINT, SIG_ACK);          LSIGNAL(SIGINT, SIG_ACK);
 #endif  #endif
         LSIGNAL(SIGINT, u_interrupt);  
         sigs |= S_INTERRUPT;          sigs |= S_INTERRUPT;
 #if MSDOS_COMPILER==DJGPPC  #if MSDOS_COMPILER==DJGPPC
         /*          /*
Line 56 
Line 52 
         if (kbhit())          if (kbhit())
                 getkey();                  getkey();
 #endif  #endif
         if (reading)  
                 intread();  
 }  }
   
 #ifdef SIGTSTP  #ifdef SIGTSTP
Line 69 
Line 63 
 stop(type)  stop(type)
         int type;          int type;
 {  {
         LSIGNAL(SIGTSTP, stop);  
         sigs |= S_STOP;          sigs |= S_STOP;
         if (reading)  
                 intread();  
 }  }
 #endif  #endif
   
Line 85 
Line 76 
 winch(type)  winch(type)
         int type;          int type;
 {  {
         LSIGNAL(SIGWINCH, winch);  
         sigs |= S_WINCH;          sigs |= S_WINCH;
         if (reading)  
                 intread();  
 }  }
 #else  #else
 #ifdef SIGWIND  #ifdef SIGWIND
Line 100 
Line 88 
 winch(type)  winch(type)
         int type;          int type;
 {  {
         LSIGNAL(SIGWIND, winch);  
         sigs |= S_WINCH;          sigs |= S_WINCH;
         if (reading)  
                 intread();  
 }  }
 #endif  #endif
 #endif  #endif
Line 267 
Line 252 
                 }                  }
   
         }          }
   }
   
   /*
    * Custom version of signal() that causes syscalls to be interrupted.
    */
           public void
   (*lsignal(s, a))()
           int s;
           void (*a) ();
   {
           struct sigaction sa, osa;
   
           sa.sa_handler = a;
           sigemptyset(&sa.sa_mask);
           sa.sa_flags = 0;                /* don't restart system calls */
           if (sigaction(s, &sa, &osa) != 0)
                   return (SIG_ERR);
           return (osa.sa_handler);
 }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5