root/lib/vfs/netutil.c

/* [previous][next][first][last][top][bottom][index][help]  */

DEFINITIONS

This source file includes following definitions.
  1. sig_pipe
  2. tcp_init

   1 /*
   2    Network utilities for the Midnight Commander Virtual File System.
   3 
   4    Copyright (C) 1995-2024
   5    Free Software Foundation, Inc.
   6 
   7    This file is part of the Midnight Commander.
   8 
   9    The Midnight Commander is free software: you can redistribute it
  10    and/or modify it under the terms of the GNU General Public License as
  11    published by the Free Software Foundation, either version 3 of the License,
  12    or (at your option) any later version.
  13 
  14    The Midnight Commander is distributed in the hope that it will be useful,
  15    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17    GNU General Public License for more details.
  18 
  19    You should have received a copy of the GNU General Public License
  20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  21  */
  22 
  23 /**
  24  * \file
  25  * \brief Source: Virtual File System: Network utilities
  26  */
  27 
  28 #include <config.h>
  29 
  30 #include <stdlib.h>
  31 #include <signal.h>
  32 #include <string.h>             /* memset() */
  33 
  34 #include "lib/global.h"
  35 
  36 #include "netutil.h"
  37 
  38 /*** global variables ****************************************************************************/
  39 
  40 SIG_ATOMIC_VOLATILE_T got_sigpipe = 0;
  41 
  42 /*** file scope macro definitions ****************************************************************/
  43 
  44 /*** file scope type declarations ****************************************************************/
  45 
  46 /*** forward declarations (file scope functions) *************************************************/
  47 
  48 /*** file scope variables ************************************************************************/
  49 
  50 /* --------------------------------------------------------------------------------------------- */
  51 /*** file scope functions ************************************************************************/
  52 /* --------------------------------------------------------------------------------------------- */
  53 
  54 static void
  55 sig_pipe (int unused)
     /* [previous][next][first][last][top][bottom][index][help]  */
  56 {
  57     (void) unused;
  58     got_sigpipe = 1;
  59 }
  60 
  61 /* --------------------------------------------------------------------------------------------- */
  62 /*** public functions ****************************************************************************/
  63 /* --------------------------------------------------------------------------------------------- */
  64 
  65 void
  66 tcp_init (void)
     /* [previous][next][first][last][top][bottom][index][help]  */
  67 {
  68     static gboolean initialized = FALSE;
  69     struct sigaction sa;
  70 
  71     if (initialized)
  72         return;
  73 
  74     got_sigpipe = 0;
  75     memset (&sa, 0, sizeof (sa));
  76     sa.sa_handler = sig_pipe;
  77     sigemptyset (&sa.sa_mask);
  78     sigaction (SIGPIPE, &sa, NULL);
  79 
  80     initialized = TRUE;
  81 }
  82 
  83 /* --------------------------------------------------------------------------------------------- */

/* [previous][next][first][last][top][bottom][index][help]  */