Diff for /freem/src/sighnd.c between versions 1.1.1.1 and 1.11

version 1.1.1.1, 2025/01/19 02:04:04 version 1.11, 2025/05/01 21:02:31
Line 1 Line 1
 /*  /*
  *                            *   *   $Id$
  *                           * *  
  *                          *   *  
  *                     ***************  
  *                      * *       * *  
  *                       *  MUMPS  *  
  *                      * *       * *  
  *                     ***************  
  *                          *   *  
  *                           * *  
  *                            *  
  *  
  *   sighnd.c  
  *    FreeM signal handlers    *    FreeM signal handlers 
  *   *
  *     *  
  *   Author: Serena Willis <jpw@coherent-logic.com>   *   Author: Serena Willis <snw@coherent-logic.com>
  *    Copyright (C) 1998 MUG Deutschland   *    Copyright (C) 1998 MUG Deutschland
  *    Copyright (C) 2020 Coherent Logic Development LLC   *    Copyright (C) 2020, 2025 Coherent Logic Development LLC
  *   *
  *   *
  *   This file is part of FreeM.   *   This file is part of FreeM.
Line 35 Line 23
  *   You should have received a copy of the GNU Affero Public License   *   You should have received a copy of the GNU Affero Public License
  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.   *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
  *   *
    *   $Log$
    *   Revision 1.11  2025/05/01 21:02:31  snw
    *   Documentation updates
    *
    *   Revision 1.10  2025/04/30 20:03:09  snw
    *   Work on entryref parser
    *
    *   Revision 1.9  2025/04/15 18:39:20  snw
    *   Remove extraneous CRLFs in logprintf calls
    *
    *   Revision 1.8  2025/04/15 16:49:36  snw
    *   Make use of logprintf throughout codebase
    *
    *   Revision 1.7  2025/04/10 01:24:38  snw
    *   Remove C++ style comments
    *
    *   Revision 1.6  2025/03/24 04:15:25  snw
    *   Create dummy onwinch signal handler for OS/2
    *
    *   Revision 1.5  2025/03/24 00:38:40  snw
    *   Fix termios junk in sighnd.c
    *
    *   Revision 1.4  2025/03/24 00:34:30  snw
    *   Fix termios junk in sighnd.c
    *
    *   Revision 1.3  2025/03/09 19:50:47  snw
    *   Second phase of REUSE compliance and header reformat
    *
    *
    * SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
    * SPDX-License-Identifier: AGPL-3.0-or-later
  **/   **/
   
 #include <stddef.h>  #include <stddef.h>
Line 47 Line 66
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/wait.h>  #include <sys/wait.h>
   
 #include <termios.h>  #if !defined(__APPLE__) && !defined(__gnu_hurd__) && !defined(EMSCRIPTEN)
   # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__AMIGA)
   #  include <termios.h>
   #  if !defined(__AMIGA)
   #   define TCGETA TIOCGETA
   #   define TCSETA TIOCSETA
   #  endif
   #  define termio termios
   # else
   #  if !defined(MSDOS)
   #    include <termio.h>
   #  endif
   # endif
   #else
   # include <termios.h>
   #endif
   
 #include <sys/ioctl.h>  #include <sys/ioctl.h>
   
 #include "mpsdef.h"  #include "mpsdef.h"
Line 56 Line 91
 #include "events.h"  #include "events.h"
 #include "jobtab.h"  #include "jobtab.h"
 #include "shmmgr.h"  #include "shmmgr.h"
   #include "log.h"
   
   
 void m_log (int, const char *);  
 int pending_signal_type = -1;  int pending_signal_type = -1;
   
 void sig_attach(int sig, void *handler)  void sig_attach(int sig, void *handler)
Line 68  void sig_attach(int sig, void *handler) Line 104  void sig_attach(int sig, void *handler)
 #if !defined(__AMIGA)      #if !defined(__AMIGA)    
     sigaction (sig, &act, NULL);      sigaction (sig, &act, NULL);
 #else  #else
     //TODO: fill in for m68k-amigaos      /* TODO: fill in for m68k-amigaos */
 #endif  #endif
 }  }
   
Line 100  void sig_init(void) Line 136  void sig_init(void)
 }  }
   
   
 #if !defined(MSDOS)  #if !defined(MSDOS) && !defined(__OS2__)
 void onwinch (void)  void onwinch (void)
 {  {
     struct winsize ws;      struct winsize ws;
Line 120  void onwinch (void) Line 156  void onwinch (void)
   
     return;      return;
 }  }
   #else
   void onwinch (void)
   {
       sig_attach (SIGWINCH, &onwinch);
   
       return;
   }
 #endif  #endif
   
 void onintr (void)  void onintr (void)
 {  {
     sig_attach (SIGINT, &onintr); /* restore handler */      sig_attach (SIGINT, &onintr); /* restore handler */
   
     //printf ("\r\nSIGINT codptr = '%s'\r\n", codptr);      /* printf ("\r\nSIGINT codptr = '%s'\r\n", codptr); */   
           
     if (first_process) {      if (first_process) {
         job_request_stop (pid);          job_request_stop (pid);
Line 152  void onintr (void) Line 195  void onintr (void)
         }          }
     }      }
   
           if (breakon) {        
     if (breakon) {  
         merr_raise (INRPT);          merr_raise (INRPT);
         inrpt_after_async = TRUE;          inrpt_after_async = TRUE;
         if (forsw) sigint_in_for = TRUE;          if (forsw) sigint_in_for = TRUE;
   
           if (usermode == 1) {
               debug_mode = TRUE;
           }
     }      }
     else {      else {
         zcc = TRUE;          zcc = TRUE;
Line 260  void onhup (void) Line 306  void onhup (void)
   
   
     if (run_daemon == TRUE) {      if (run_daemon == TRUE) {
         fprintf (stderr, "freem:  daemon received SIGHUP\r\n");          logprintf (FM_LOG_INFO, "environment:  daemon received SIGHUP");
         m_log (1, "freem:  daemon received SIGHUP");  
   
         sig_attach (SIGHUP, &onhup);       /* restore handler */          sig_attach (SIGHUP, &onhup);       /* restore handler */
                   

Removed from v.1.1.1.1  
changed lines
  Added in v.1.11


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>